SugarCRM REST: Difference between revisions
Jkuehlthau (talk | contribs) No edit summary |
Jkuehlthau (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
Note the [{...}] surrounding the filter. This is required. | Note the [{...}] surrounding the filter. This is required. | ||
<code> | <code> | ||
[{"id":"84b1c05c-1043-05c8-ced8-53a2ed18427b"}] | [{"id":"84b1c05c-1043-05c8-ced8-53a2ed18427b"}] | ||
</code> | </code> | ||
A more complex filter: | A more complex filter: | ||
<code> | <code> | ||
[{"$or":[{"import_source_id_c":{"$not_null":""}},{"import_source_id_c":{"$not_equals":""}}]}] | [{"$or":[{"import_source_id_c":{"$not_null":""}},{"import_source_id_c":{"$not_equals":""}}]}] | ||
</code> | </code> | ||
Note that the $not_null operation still requires a blank string. | Note that the $not_null operation still requires a blank string. | ||
Line 16: | Line 20: | ||
==Date Fields== | ==Date Fields== | ||
<code> | <code> | ||
Function ScriptedField | |||
ScriptedField=FormatDate("@@ORG:renewal_date_c@@", "yyyy-MM-dd") | |||
End Function | |||
</code> | </code> | ||
==Datetime Fields== | ==Datetime Fields== |
Revision as of 20:06, 8 October 2014
SugarCRM REST Origin
Sample Origin Filters
See the GET /<module> filterList in the SugarCRM REST Help: https://SERVER/rest/v10/help/
Note the [{...}] surrounding the filter. This is required.
[{"id":"84b1c05c-1043-05c8-ced8-53a2ed18427b"}]
A more complex filter:
[{"$or":[{"import_source_id_c":{"$not_null":""}},{"import_source_id_c":{"$not_equals":""}}]}]
Note that the $not_null operation still requires a blank string.
Mapping
Date Fields
Function ScriptedField
ScriptedField=FormatDate("@@ORG:renewal_date_c@@", "yyyy-MM-dd")
End Function
Datetime Fields
Function ScriptedField ScriptedField=FormatDate("@@ORG:date_entered@@", "yyyy-MM-ddTHH:mm:ss") End Function
VBScript Smart Lookup
When filtering in a smart lookup, the filter must use double-double quotes:
strSugarID = SmartLookup("Accounts","id","[{""import_source_id"":""84b1c05c-1043-05c8-ced8-53a2ed18427b""}]")
Multi-select Dropdowns
Data in Multiselect Dropdowns is stored as a comma separated string with carats around each value: ^Atari^,^Automobiles^,^Baseball^,^Fine_Art^,^Running_Walking^
Sample Function:
Function ScriptedField dim cat cat = "@@ORG:Categories@@" dim res If InStr(cat,"Board Invitee") Then res = res & "^Board_Invitee^," End If If InStr(cat,"Priority Contact") Then res = res & "^Priority_Contact^," End If If InStr(cat,"Dividend Contact") Then res = res & "^Dividend_Contact^," End If If Right(res,1) = "," Then res = Left(res,Len(res)-1) End If ScriptedField=res End Function
Checkbox
When mapping to a checkbox, does it require returning True or some other value? 1?