AgileApps Support Wiki Pre Release

Difference between revisions of "REST API/Payload Examples"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
:* The <tt><nowiki><tableColumn></nowiki></tt> element is the field '''name'''.
:* The <tt><nowiki><tableColumn></nowiki></tt> element is the field '''name'''.
:* <tt><nowiki><customVisibilityCriteria></nowiki></tt> elements, when present, reflect non-default [[Field#Field Visibility|Field Visibility]] settings.
:* <tt><nowiki><customVisibilityCriteria></nowiki></tt> elements, when present, reflect non-default [[Field#Field Visibility|Field Visibility]] settings.
:* The <tt><nowiki>isCaseSpecialField</nowiki></tt> attribute is valid only for the GET request. A user cannot the set the value for this attribute. This value is set to '''True''' for all standard case or case type specific fields like subject, description, status, and priority. In all other cases, it is set to '''False'''.
:* The <tt><nowiki>isCaseSpecialField</nowiki></tt> element is a read-only attribute. A user cannot the set the value for this attribute. This value is set to '''True''' for all standard cases or case-type specific fields like subject, description, status, and priority. In all other cases, it is set to '''False'''.


====Auto Number Field====
====Auto Number Field====

Latest revision as of 06:39, 16 November 2018

These are payload examples for the REST API field Resource.

In all examples:

  • The <title> element is the field's display label.
  • The <tableColumn> element is the field name.
  • <customVisibilityCriteria> elements, when present, reflect non-default Field Visibility settings.
  • The isCaseSpecialField element is a read-only attribute. A user cannot the set the value for this attribute. This value is set to True for all standard cases or case-type specific fields like subject, description, status, and priority. In all other cases, it is set to False.

Auto Number Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>AUTO</type>
        <description>...</description>
        <universalProperty>true</universalProperty>
        <startingNumber>0001</startingNumber>
        <autoNumberFormat>YYYY-MM-DD-{0000}</autoNumberFormat>
    </field>
</platform>

Notepad.png

Note: The startingNumber field is editable only during add/POST requests and not during update/PUT requests.

CheckBox Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>BOOLEAN</type>
        <description>...</description>
        <defaultValue>true</defaultValue>
        <universalProperty>false</universalProperty>
    </field>
</platform>

Currency Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>CURRENCY</type>
        <description>...</description>
        <universalProperty>false</universalProperty>
        <maxFractionalDigits>2</maxFractionalDigits>
        <displayLength>30</displayLength>
    </field>
</platform>

Date Field

String postXml =  "<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>DATE</type>
        <description>...</description>
        <universalProperty>false</universalProperty>
    </field>
</platform>

An additional <display> property can also be specified for custom fields in Custom Objects, with the values:

  • as_entered - Store and display the value as entered.
  • convert - Convert the value between time zones.

For example:

String postXml =  "<platform>
    <field>
        ...
        <display>as_entered</display>
    </field>
</platform>
Learn more: Date/Time Display Types

DateTime Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>DATETIME</type>
        <description>...</description>
        <universalProperty>false</universalProperty>
    </field>
</platform>

An additional <display> property can also be specified for custom fields in Custom Objects, with the values:

  • as_entered - Store and display the value as entered.
  • convert - Convert the value between time zones.

For example:

String postXml =  "<platform>
    <field>
        ...
        <display>as_entered</display>
    </field>
</platform>
Learn more: Date/Time Display Types

Dependent Picklist Field

<platform>
<field>
    <title>FIELD LABEL</title>
    <tableColumn>FIELD_NAME</tableColumn>
    <type>DEPENDENT_PICK_LIST</type>
    <description>...</description>
    <parentPicklistId>70ab83f90c7c49f4</parentPicklistId>
    <universalProperty>false</universalProperty>
    <enumerationDetails>
        <showFirstValueAsDefault>false</showFirstValueAsDefault>
        <sortFlag>false</sortFlag>
        <enumerationItems>
            <picklistValue>1</picklistValue>
        </enumerationItems>
        <enumerationItems>
            <picklistValue>2</picklistValue>
        </enumerationItems>
        <enumerationItems>
            <picklistValue>3</picklistValue>
        </enumerationItems>
        <enumerationItems>
            <picklistValue>4</picklistValue>
        </enumerationItems>
        <enumerationItems>
            <picklistValue>5</picklistValue>
        </enumerationItems>
    </enumerationDetails>
    </field>
</platform>

Email Address

<platform>
<field>
    <title>FIELD LABEL</title>
    <tableColumn>FIELD_NAME</tableColumn>
    <type>LEAD_EMAIL</type>
    <description>...</description>
    <isStandard>false</isStandard>
    <universalProperty>true</universalProperty>
    <displayLength>200</displayLength>
    <maxStorageLength>200</maxStorageLength>
    <customFieldVisibility>
        <roleId>1</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>2</roleId>
        <attribute>HIDDEN</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>3</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>1714555710</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
        <extendedFieldMetaData>Extended data</extendedFieldMetaData>
    </field>
</platform>

Email Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>LEAD_EMAIL</type>
        <description>...</description>
        <universalProperty>true</universalProperty>
        <maxStorageLength>50</maxStorageLength>
        <displayLength>30</displayLength>
    </field>
</platform>

File Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>FILE_FIELD</type>
        <description>...</description>
    </field>
</platform>

Formula Field (date)

Returns a date and no destination field.

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>FORMULA</type>
        <description>...</description>
        <numberPrecision>0</numberPrecision>
        <universalProperty>false</universalProperty>
        <formula>DATE(2010, 12, 1)</formula>
        <formulaReturnType>DATE</formulaReturnType>
        <formulaDestinationField/>
    </field>
</platform>

An additional <display> property can also be specified for custom fields in Custom Objects, with the values:

  • as_entered - Store and display the value as entered.
  • convert - Convert the value between time zones.

For example:

String postXml =  "<platform>
    <field>
        ...
        <display>as_entered</display>
    </field>
</platform>
Learn more: Date/Time Display Types

Formula Field (number)

Returns a number and a Destination

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>FORMULA</type>
        <description>...</description>
        <numberPrecision>2</numberPrecision>
        <formula>wink_currency + wink_currency</formula>
        <formulaReturnType>NUMBER</formulaReturnType>
        <formulaDestinationField>wink_currency</formulaDestinationField>
        <formula>wink_currency + wink_currency</formula>
    </field>
</platform>

Global Picklist Field

This payload describes an Object field that references a Global Picklist.
To create or modify a Global Picklist, use the REST API:globalPicklist Resource.

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>GLOBAL_PICK_LIST</type>
        <description>...</description>
        <universalProperty>false</universalProperty>
        <enumerationDetails>
            <showFirstValueAsDefault>true</showFirstValueAsDefault>
            <sortFlag>false</sortFlag>
        </enumerationDetails>
        <globalPicklistId>dabda8ae68a74718a01286a676d3efdc</globalPicklistId>
    </field>
</platform>

Image File Field

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>IMAGE_FIELD</type>
        <description>...</description>
        <universalProperty>false</universalProperty>
    </field>
</platform>

Lookup Field

Lookup to a System Object

Add a Lookup to a System Object, with some preset filters:

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>LOOKUP</type>
        <description>...</description>
        <universalProperty>false</universalProperty>
        <lookUpObjectId>f5ed02cfbfdd4a4aaf2f2a3673f29741</lookUpObjectId>
        <lookupDisplayType>POPUP</lookupDisplayType>
        <sortBy>date_created</sortBy>
        <sortOrder>asc</sortOrder>
        <lookupPresetFilter>
            <criteria_1_join_operator/>
            <criteria_1_pre_bracket>(</criteria_1_pre_bracket>
            <criteria_1_post_bracket>)</criteria_1_post_bracket>
            <criteria_1_column>auto_number</criteria_1_column>
            <criteria_1_operator>equals</criteria_1_operator>
            <criteria_1_value>11111</criteria_1_value>
            <criteria_2_join_operator>and</criteria_2_join_operator>
            <criteria_2_pre_bracket/>
            <criteria_2_post_bracket>)</criteria_2_post_bracket>
            <criteria_2_column>wink_currency</criteria_2_column>
            <criteria_2_operator>equals</criteria_2_operator>
            <criteria_2_value>1</criteria_2_value>
            <criteria_3_join_operator>and</criteria_3_join_operator>
            <criteria_3_pre_bracket/>
            <criteria_3_post_bracket/>
            <criteria_3_column/>
            <criteria_3_operator>equals</criteria_3_operator>
            <criteria_3_value/>
            <criteria_4_join_operator>and</criteria_4_join_operator>
            <criteria_4_pre_bracket/>
            <criteria_4_post_bracket/>
            <criteria_4_column/>
            <criteria_4_operator>equals</criteria_4_operator>
            <criteria_4_value/>
            <criteria_5_join_operator>and</criteria_5_join_operator>
            <criteria_5_pre_bracket/>
            <criteria_5_post_bracket/>
            <criteria_5_column/>
            <criteria_5_operator>equals</criteria_5_operator>
            <criteria_5_value/>
        </lookupPresetFilter>
        <recordSelectionType>STANDARD_LOOKUP</recordSelectionType>
        <lookupDependentFieldList>
            <fieldId>63a2f09f16a14af999b81858363b34ba</fieldId>
            <baseFieldId>ebc004fdebb64a8888fc07d5a824c63d</baseFieldId>
        </lookupDependentFieldList>
        <lookupDependentFieldList>
            <fieldId>df02eaaab877428093dda87d8d29022d</fieldId>
            <baseFieldId>98e0b1ae0b8143b28cb1356c364e6ad1</baseFieldId>
        </lookupDependentFieldList>
        <postSelectionJS>alert(\"hello\");</postSelectionJS>
        <lookupFields>98e0b1ae0b8143b2,ebc004fd24c63d,...
        </lookupFields>
    </field>
</platform>
Lookup to a Custom Page

Add a Lookup to a Custom Object:

<platform>
    <field>
        <title>FIELD LABEL</title>
        <tableColumn>FIELD_NAME</tableColumn>
        <type>LOOKUP</type>
        <description>...</description>
        <universalProperty>true</universalProperty>
        <lookUpObjectId>f0772f53f82d41879a50c5392de83c3f</lookUpObjectId>
        <customPageId>e379c6e9dd694441b3f525fc7e0c0beb</customPageId>
        <recordSelectionType>CUSTOM_PAGE</recordSelectionType>
        <lookupFields/>
        <isMasterDetailRelationship>false</isMasterDetailRelationship>
        <lookupDisplayType>DROP_DOWN</lookupDisplayType>  
        <extendedFieldMetaData>Testing</extendedFieldMetaData>
        <lookupAutoCopyFields>    
            <lookupAutoCopyField>
               <srcFieldColumn>       // Source field Info
                   <tableColumn>a_currency</tableColumn>
               </srcFieldColumn>
               <destFieldColumn>      // Destination field info
                   <tableColumn>b_fmcurrency</tableColumn>
               </destFieldColumn>
            </lookupAutoCopyField>
            <lookupAutoCopyField>
              ...
            </lookupAutoCopyField>
              ...
        <lookupAutoCopyFields>
     </field>
</platform>
Field Notes
Field Possible Values Notes
lookupDisplayType
  • POPUP
  • DROP_DOWN
sortBy Internal field name

These tags are used for:

They are not used for other kinds of lookups (hierarchical, view/report, custom page), or for lookups to System Objects shown in a PopUp display.

sortOrder
  • asc
  • desc
tableColumn Internal field name

Notepad.png

Note: Internal field names are those returned by the field resource.

Multi Checkbox

<platform>
<field>
    <title>Wink Multi Check Box</title>
    <type>MULTI_CHECK_BOX</type>
    <tableColumn>wink_multi_check_box</tableColumn>
    <universalProperty>false</universalProperty>
    <enumerationDetails>
        <showFirstValueAsDefault>true</showFirstValueAsDefault>
        <sortFlag>true</sortFlag>
        <enumerationItems>
            <picklistLabel>label1</picklistLabel>
            <picklistValue>value1</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
        <enumerationItems>
            <picklistLabel>label2</picklistLabel>
            <picklistValue>value2</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
        <enumerationItems>
            <picklistLabel>label3</picklistLabel>
            <picklistValue>value3</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
        <enumerationItems>
            <picklistLabel>label4</picklistLabel>
            <picklistValue>value4</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
        <enumerationItems>
            <picklistLabel>label5</picklistLabel>
            <picklistValue>value5</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
    </enumerationDetails>
    <orientation>HORIZONTAL</orientation>
    <description>...</description>
    <customFieldVisibility>
        <roleId>1</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>2</roleId>
        <attribute>HIDDEN</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>3</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>1714555710</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <extendedFieldMetaData>Extended Meta data</extendedFieldMetaData>
</field>
</platform>

Multi Object Lookup

An example that has Post Selection JavaScript for the Multi Object Lookup field.

Notepad.png

Note: Either object name or object ID can be used in the <lookUpObjectId> element to specify a target object.

<platform>
    <field>
        <title>Wink lookup 1</title>
        <type>MULTI_OBJECT_LOOKUP</type>
        <tableColumn>molf1</tableColumn>
        <universalProperty>false</universalProperty>
        <multiObjectLookUpDetails>
            <includeAllObjects>false</includeAllObjects>
            <lookUpObjectId>ACCOUNT</lookUpObjectId>
            <lookUpObjectId>CONTACT</lookUpObjectId>
        </multiObjectLookUpDetails>
        <recordSelectionType>STANDARD_LOOKUP</recordSelectionType>
        <postSelectionJS>alert(\"this works\");</postSelectionJS>
        <description>...</description>
    </field>
</platform>

An example that uses a custom JSP for the lookup:

<platform>
    <field>
        <title>Wink lookup 1</title>
        <type>MULTI_OBJECT_LOOKUP</type>
        <tableColumn>molf1</tableColumn>
        <universalProperty>false</universalProperty>
        <multiObjectLookUpDetails>
            <lookUpObjectId>ACCOUNT</lookUpObjectId>
            <lookUpObjectId>CONTACT</lookUpObjectId>
        </multiObjectLookUpDetails>
        <recordSelectionType>CUSTOM_PAGE_STR</recordSelectionType>
        <customPageId>e379c6e9dd694441b3f525fc7e0c0beb</customPageId>
        <description>...</description>
    </field>
</platform>

;Considerations:
:* <tt>includeAllObjects</tt> is true for a multi-object lookup field that can target any object in the platform. When true, the <tt>lookUpObjectId</tt> list contains an entry for every possible object.

Number

<platform>
    <field>
        <title>Wink number field</title>
        <type>NUMBER</type>
        <tableColumn>wink_number</tableColumn>
        <description>...</description>
        <isSignField>false</isSignField>
        <minNumericValue>0</minNumericValue>
        <maxNumericValue>0</maxNumericValue>
    </field>
</platform>

Number with Decimals

<platform>
    <field>
        <title>Wink number field</title>
        <type>DOUBLE</type>
        <tableColumn>test_field_decimal</tableColumn>
        <description>...</description>
        <isSignField>false</isSignField>
        <maxFractionalDigits>2</maxFractionalDigits>
        <displayLength>30</displayLength>
    </field>
</platform>

Picklist

<platform>
<field>
    <title>Wink Picklist</title>
    <type>PICK_LIST</type>
    <tableColumn>wink_picklist</tableColumn>
    <universalProperty>false</universalProperty>
    <enumerationDetails>
        <showFirstValueAsDefault>true</showFirstValueAsDefault>
        <sortFlag>false</sortFlag>
        <enumerationItems>
            <picklistLabel>label1</picklistLabel>
            <picklistValue>value1</picklistValue>
            <itemOrder>1</itemOrder>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
        <enumerationItems>
            <picklistLabel>label2</picklistLabel>
            <picklistValue>value2</picklistValue>
            <itemOrder>2</itemOrder>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
    </enumerationDetails>
    <customFieldVisibility>
        <roleId>1</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>2</roleId>
        <attribute>HIDDEN</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>3</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>1714555710</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
        <description>...</description>
        <extendedFieldMetaData>Extended Meta data</extendedFieldMetaData>
    </field>
</platform>
Considerations
  • If the sortFlag is true, then itemOrder elements are not needed, as the elements are sorted alphabetically by label.
  • If false, then itemOrder determines the order in which the elements are displayed.
  • If itemOrder is not present, elements are displayed in the order they are defined.

Radio Button

<platform>
<field>
    <title>Wink Radio Button</title>
    <type>RADIO_BUTTON</type>
    <tableColumn>wink_radio_button</tableColumn>
    <universalProperty>true</universalProperty>
    <enumerationDetails>
        <showFirstValueAsDefault>true</showFirstValueAsDefault>
        <sortFlag>true</sortFlag>
        <description>...</description>
        <enumerationItems>
            <picklistLabel>1</picklistLabel>
            <picklistValue>value1</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
            </enumerationItems>
        <enumerationItems>
            <picklistLabel>2</picklistLabel>
            <picklistValue>value2</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
        <enumerationItems>
            <picklistLabel>3</picklistLabel>
            <picklistValue>value3</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
            </enumerationItems>
        <enumerationItems>
            <picklistLabel>4</picklistLabel>
            <picklistValue>value4</picklistValue>
            <textColor>#000000</textColor>
            <textBgColor>#FFFFFF</textBgColor>
        </enumerationItems>
    </enumerationDetails>
    <orientation>VERTICAL</orientation>
    <customFieldVisibility>
        <roleId>1</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>2</roleId>
        <attribute>HIDDEN</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>3</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>1714555710</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <description>...</description>
    <extendedFieldMetaData>extended data</extendedFieldMetaData>
</field>

</platform>

Rich Text Area

<platform>
<field>
        <title>Wink Rich Text Area</title>
        <type>RICHTEXT_AREA</type>
        <tableColumn>wink_rich_text_area</tableColumn>
        <universalProperty>true</universalProperty>
        <description>...</description>
        <width>600</width>
        <customFieldVisibility>
        <roleId>1</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>2</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>3</roleId>
        <attribute>HIDDEN</attribute>
    </customFieldVisibility>
        <extendedFieldMetaData>Rich Text Area</extendedFieldMetaData>
    </field>
</platform>

Text Area

<platform>
<field>
    <title>Wink Text Area</title>
    <type>TEXT_AREA</type>
    <tableColumn>wink_text_area</tableColumn>
    <universalProperty>true</universalProperty>
    <description>...</description>
    <width>100</width>
    <height>100</height>
    <customFieldVisibility>
        <roleId>1</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>2</roleId>
        <attribute>READ_ONLY</attribute>
    </customFieldVisibility>
    <customFieldVisibility>
        <roleId>3</roleId>
        <attribute>HIDDEN</attribute>
    </customFieldVisibility>
    <extendedFieldMetaData>Text Area</extendedFieldMetaData>
</field>
</platform>

Text Field

<platform>
    <field>
        <title>Wink Text Field</title>
        <type>TEXT_FIELD</type>
        <tableColumn>winkTextField</tableColumn>
        <universalProperty>false</universalProperty>
        <displayLength>30</displayLength>
        <description>...</description>
        <maxStorageLength>50</maxStorageLength>
        <customFieldVisibilityList>
            <roleId>1215761260</roleId>
            <attribute>READ_ONLY</attribute>
        </customFieldVisibilityList>
        <customFieldVisibilityList>
            <roleId>1</roleId>
            <attribute>READ_ONLY</attribute>
        </customFieldVisibilityList>
        <customFieldVisibilityList>
            <roleId>2</roleId>
            <attribute>READ_ONLY</attribute>
        </customFieldVisibilityList>
        <customFieldVisibilityList>
            <roleId>3</roleId>
            <attribute>READ_ONLY</attribute>
        </customFieldVisibilityList>
    </field>
</platform>