Processing data sequentially and in parallel
Catalog administrators and internal service suppliers can design workflows that process multiple arrays of data within a workflow activity. Multiple data can be processed sequentially or in parallel by configuring a multi instance loop for an activity.
How Multi Instance Loop function works
A multi instance loop defines repetition for a process activity. It allows execution of the activity for each item in an array of data. Multi instance loop is available with the Call Activity, Sub-Process, Receive Task; String Utils, Service Broker, and connector activities.
Any activity that has Multi Instance Loop configuration, uses a process variable configured as the Input Data Item, and processes the input to perform the operation. The Multi Instance Loop configuration options are available in the Properties pane of the selected activity:
Before you begin
- Create a required workflow; for information about how to design a workflow, see Designing a simple workflow
- Add a local variable of the object data type to your workflow, see Adding local variables to a workflow
To enable a multi instance loop for an activity in a workflow
- In the workflow designer, select an activity element for which you want to use Multi instance loop.
In the Properties pane, in the MULTI INSTANCE LOOP section, enter the values for the following properties:
It allows executing a certain activity for each item in a given collection, sequentially or in parallel.
Note: If you do not select the Loop Type, multi instance loop is not enabled on the activity.
Loop Data Input
An expression that represents a collection of items. It refers to an array of data such as a list of task records, or a list of approvers.
Input Data Item
A process variable that represents data type of each item in an array. It is assigned with a value from the Loop Data Input array (such as a task record or name of an approver).
Completion Criteria (Optional) If you do not want the process to loop through all data, configure Completion Criteria.
A multi instance activity ends when all instances are finished. However, it is possible to specify an expression that is evaluated every time an instance ends. When this expression evaluates to true, all remaining instances are skipped, and the multi instance activity ends. The process continues thereafter.
For example, in an approval use case, you can use completion condition to define if 3 out of 5 users have approved the request, the loop is considered complete.
- Save the workflow.
Example of a workflow that uses a multi-instance loop
The following workflow is configured to send multiple arrays of data received from the Get Entries By Query activity to the multiple instances of the Send In App Notification activity.
The following workflow is configured to send an in app notification per entry returned by the Get Entries By Query activity.
The Input Map of the Send In App Notification shown in the example contains the following information:
- Receiver—hannah_admin is the user who will receive the in app notification when the process is executed
- Title—the title text of the notification
- Content—the content of the notification is configured to display information mapped to a variable specified in the Input Data Item of the multi-instance loop; in this case, it is a local variable of the object data type
The Multi Instance Loop of the Send In App Notification shown in the example contains the following information:
- Loop type—the notifications will be received sequentially
- Loop Data Input—the information retrieved from any activity in a workflow; in this case, it is an output from the Get Entries By Query activity.
- Input Data Item—a variable that can process multiple entries; in this case, it is a local variable of the object data type
- Completion Criteria—no criteria is defined; the notifications will be sent until all entries retrieved by the Get Entries By Query activity are processed.
When the described workflow is executed, the receiver of the Send In App Notification activity receives so many notifications, as many entries the Get Entries By Query activity retrieves. The following screenshot shows multiple notifications sent to this user.