Using Multi-Request Service Helpers
Helpers are functions that create objects, set values, or append values in a specific slot in the multi-request array.
Search Helpers
Search helpers build searches that reference objects created elsewhere in a multi-request.
<mapping id='MultiRequestSlot'>Helper ObjectSourceSlot</mapping>
- MultiRequestSlot is a number that specifies the multi-request slot.
- Helper is one of the search helpers listed below.
- ObjectSourceSlot is a number that specifies the slot where the object was created.
buildDeviceSearchMulti
— Builds device searches that reference devices created elsewhere in a multi-request. For example, to create a device search object in theDeviceSearchData
field of a request in slot 3 of the array that references the device created in slot 2 of the array, declare the following:<mapping id='3'>buildDeviceSearchMulti 2</mapping>
buildGroupSearchMulti
— Builds group searches that reference groups created elsewhere in a multi-request. For example, to create a group search object in theGroupSearchData
field of a request in slot 8 of the array that references the group created in slot 6 of the array, declare the following:<mapping id='8'>buildGroupSearchMulti 6</mapping>
buildSubscriberSearchMulti
— Builds subscriber searches that reference subscribers created elsewhere in a multi-request. For example, to create a subscriber search object in theSubscriberSearchData
field of a request in slot 7 of the array that references the subscriber created in slot 1 of the array, declare the following:<mapping id='7'>buildSubscriberSearchMulti 1</mapping>
buildSubscriptionSearchMulti
— Builds subscription searches that reference subscriptions created elsewhere in a multi-request. For example, to create a subscription search object in theSubscriptionSearchData
field of a request in slot 4 of the array that references the subscriber created in slot 1 of the array, declare the following:<mapping id='4'>buildSubscriptionSearchMulti 1</mapping>
buildUserSearchMulti
— Builds user searches that reference users created elsewhere in a multi-request. For example, to create a user search object in theUserSearchData
field of a request in slot 4 of the array that references the subscriber created in slot 0 of the array, declare the following:<mapping id='4'>buildUserSearchMulti 0</mapping>
Set or Append Field Helpers
The setOrAppendField
helper modifies a field in a specified array slot. You can specify a value by specifying a field and value (such as a string or integer) or you can
use a helper that creates a data container with a complex value.
<mapping id='MultiRequestSlot'>setOrAppendField "NamedField" "FieldValue"</mapping>
- MultiRequestSlot is the multi-request slot.
- NamedField is the field name.
- FieldValue is the field value.
<mapping id='4'>setOrAppendField "Age" 42</mapping>
<mapping id='4'>setOrAppendField "HairColor" "Blonde"</mapping>
<mapping id='MultiRequestSlot'>setOrAppendField "NamedField" Helper("HelperArgument")</mapping>
- MultiRequestSlot is the multi-request slot.
- NamedField is the field name.
- Helper is one of the following helpers and the syntax of HelperArgument is determined by Helper:
fromJson
— Reads in an object defined in JSON that is used insetOrAppendField
. In the following example, the JSON object is used as the role definition that is set in theRoleArray
field in slot 4 of the multi-request bysetOrAppendField
:<mapping id='4'>setOrAppendField "RoleArray" fromJson("{\"$\":\"MtxRoleData\", \"PricingId\": \"3\"}")</mapping>
fromResource
— Reads in an object defined in a JSON resource that is used insetOrAppendField
. ThefromResource
argument is the path to the resource. The JSON is similar to thefromJson
example's embedded string. In the following example, the JSON object defined in Role3.json is used as the role definition that is set in theRoleArray
field in slot 4 of the multi-request bysetOrAppendField
:<mapping id='4'>setOrAppendField "RoleArray" fromResource("/com/acme/extension/Role3.json")</mapping>
Set or Append Value Helper
The setOrAppendValue
helper modifies a field value in a specified array slot that is not a top-level field in the MDC. If the field is an array and is not an instance
of ArrayList
, the value is appended; otherwise, the value is set. If the field is not an array, the value is set.
<mapping id='MultiRequestSlot'>setOrAppendValue "container" "pathExpression" "value"</mapping>
- MultiRequestSlot is the multi-request slot.
- container is the MDC.
- pathExpression is the path to the field.
- value is the value to set in the array slot.
DateOffset
field is set to 10 and the value is set in slot 4 of the
multi-request:<mapping id='8'>setOrAppendValue "MtxRequestGroupModify" "BillingCycle.DateOffset" "10"</mapping>
Set Value Helper
The setValueAt
helper sets a value in an array structure in a specified slot in the array.
<mapping id='MultiRequestSlot'>setValueAt "container" "pathExpression" "slot" "value"</mapping>
- MultiRequestSlot is the multi-request slot.
- container is the MDC.
- pathExpression is the path to the array field.
- slot is the integer value of the slot in the array to write to.
- value is the value to set in the array slot.
PostalCode
field is set to 81201 in slot 2 of the array and the value is set in slot 4 of the
multi-request:<mapping id='8'>setValueAt "MtxRequestGroupModify" "ServiceAddress.PostalCode" "2" "81201"</mapping>