You are here:
Process Arrays Using Loop Blocks (Managed Package)
For the managed package runtime, a Loop Block iterates over the items in a data array, enabling the Actions within it to repeat for each item. For example, in Salesforce Industries Communications, Media, and Energy, without a Loop Block, adding four products to a cart would require running four separate Remote Actions. But one Remote Action within a Loop Block can add all four products.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
Loop Blocks are available in Spring '19 and later releases.
The array input to the Loop Block is processed so that each iteration receives only one item in the array. For example, suppose the array input looks like this:
{
"Products": {
"Ids": [
{
"Id": 1
},
{
"Id": 2
}
]
}
}Each iteration of the Loop Block would receive input that looks like this:
{
"Products": {
"Ids": {
"Id": 1
}
}
}The iteration input is the data to which Actions within the Loop Block have access.
Nested Loop Blocks aren't supported. However, you can call one Integration Procedure with a Loop Block from another.
To configure a Loop Block:
- Drag a Loop Block into the structure panel.
- In the Loop Block property field labeled Loop List, enter the name of a JSON node that contains an array of data. For example, entering Products:Ids provides a list of Ids to the Action. The JSON node name does not need to be entered with merge field syntax.
-
Add any Action that needs to iterate over the array and pass the full the path of the
array to the action.
For example, if the Loop List is set to an array named Products:Ids that contains key-value pairs of Ids, the full path in the action would be Products:Ids:Id.
For more information on Actions, see Integration Procedure Actions (Managed Package).
NoteThe Integration Procedure stops running and returns a response of
{ "Success": "False" }if an Action that has Fail on Step Error checked fails. -
Under the Loop Block property field labeled Loop Output, click
Add Key/Value Pair to add Key-Value pairs to set the response.
The value field uses merge field syntax, meaning the node name of the response set between
two percentage signs, for example,
%ResponseData:Names%. -
(Optional) Add Conditional Logic to define when the Loop Block runs. For more
information on Conditional Logic, see Define Execution Logic Using Conditional Blocks (Managed Package).
For additional Loop Block examples, see Integration Procedure Action for Integration Procedures (Managed Package), Enhance Performance Using Cache Blocks (Managed Package), and Cache for Top-Level Integration Procedure Data (Managed Package).
- Loop Block Properties (Managed Package)
For the managed package runtime, these properties are unique to or function in a unique manner in Loop Blocks. A Loop Block iterates over the items in a data array, enabling the Actions within it to repeat for each item. - Create a Loop Block Example that Retrieves Names (Managed Package)
For the managed package runtime, an Integration Procedure accepts last names and returns the full names of all Contacts having the specified last names. - Create a Loop Block Example that Creates Contacts (Managed Package)
For the managed package runtime, an Integration Procedure accepts an Account Id and an array of first and last names and creates new Contacts for the specified Account. It also includes a step that deletes these Contacts, which you can optionally disable. - Create a Loop Block Example that Concatenates List Items (Managed Package)
For the managed package runtime, an Integration Procedure concatenates the values of items in a list. In this case, it creates an underscore-separated String of QuoteLineItem Ids. - Create a Loop Block Example That Adds Values to List Items Using Conditions (Managed Package)
For the managed package runtime, an Integration Procedure adds a dynamic value to each item in a list using conditions. Although dynamic in the list, the values are hard-coded in the Integration Procedure. Use this approach if you know or care about a specific set of possible values. - Create a Loop Block Example That Adds Values to List Items Using VALUELOOKUP (Managed Package)
For the managed package runtime, an Integration Procedure adds a dynamic value to each item in a list using the VALUELOOKUP function. The values aren't hard-coded in the Integration Procedure. Use this approach if you don't know the set of possible values in the input.

