Skip to main content

Loop

The Loop activity allows you to iterate over an array of data and perform a set of actions for each item. It contains an embedded activity that executes once per element in the provided array. Within the loop, you can use value to reference the current item being processed.

For example, you can automate a personalized welcome email for multiple customers by using placeholders like {{ value.email }} and {{ value.name }} inside your message or activity configurations.

Loop Input

The input defines the array that the Loop will iterate over. It can come from:

  • The workflow payload
  • The result of previous activities

Example:

{
"payload": {
"users": [
{ "name": "Alice", "email": "[email protected]" },
{ "name": "Bob", "email": "[email protected]" }
]
}
}

You can then reference each user in the loop using {{ value.name }} or {{ value.email }}.

Configure Execution Mode

The Loop activity supports multiple modes to control how iterations are executed:

1. Parallel

Executes all iterations simultaneously. This mode is ideal for independent tasks where execution order doesn't matter.

2. Sequential

Executes each iteration one at a time, waiting for the previous iteration to complete before starting the next. This ensures order and dependency between loop runs.

3. Batch

Combines parallel and sequential execution. Runs iterations in batches, where each batch is executed in parallel, and subsequent batches run sequentially. This mode helps optimize performance while maintaining control over resource usage.

Example Use Cases

  • Sending personalized emails to multiple users.
  • Processing or transforming datasets row by row.
  • Running API calls for each record in a collection.
  • Performing bulk updates or inserts with controlled concurrency.

Notes

  • Use value to access each item's properties inside the loop.
  • Ensure the input array is not empty to prevent no-iteration runs.
  • For large datasets, use Batch mode to balance performance and stability.