Blocks
Loop Block
Iterate over collections to process each item in a workflow
The Loop block iterates over a collection (array) and executes its contained blocks once for each item. Use it to process line items, batch records, or iterate over API results.
Configuration
| Option | Type | Description |
|---|---|---|
collection | expression | The array to iterate over (e.g., {{steps.fetch.output.items}}) |
itemVariable | string | Name for the current item (default: item) |
indexVariable | string | Name for the current index (default: index) |
breakCondition | condition | Stop When in the panel. Optional. Stops the loop early once the condition is true. Checked after each item; when items run concurrently, after each batch, so set batchSize too or it is checked only once, after all items |
batchSize | number | Batch Size in the panel. Optional. Processes the collection in groups of this many items (1 to 1000) |
maxIterations | number | Safety limit to prevent infinite loops (default: 100) |
How It Works
- The Loop block receives an array from an upstream block
- For each item in the array, it executes all blocks connected inside the loop
- Each iteration has access to the current
itemandindex - After all iterations complete, downstream blocks receive the collected results
Example Patterns
Process Invoice Line Items
Salesforce (get line items) -> Loop (for each line item)
-> Stripe (create invoice item)
-> End Loop -> Stripe (finalize invoice)Batch Customer Notifications
QuickBooks (list overdue invoices) -> Loop (for each invoice)
-> Slack (send reminder to customer channel)Multi-Record Sync
HubSpot (list updated deals) -> Loop (for each deal)
-> Transform (map to QB format) -> QuickBooks (update record)Best Practices
- Set
maxIterationsappropriately. For known-size collections, set it to the expected max. This prevents runaway execution. - Keep loop bodies lightweight. Heavy operations inside loops multiply execution time. Consider using Parallel blocks for independent iterations.
- Handle empty collections. If the input array is empty, the loop body never executes. Downstream blocks receive an empty results array.
Parallel Block
Execute multiple paths concurrently
Condition Block
Branch based on item properties inside loops
Frequently Asked Questions
If the input array is empty, the loop body is never executed. Downstream blocks receive an empty results array. The workflow continues normally.
Yes. You can place a Loop block inside another Loop block to handle nested data structures. Each loop has its own item and index variables.
The default maxIterations is 100. You can increase this in the block configuration, but be mindful of execution time and API rate limits. For very large collections, consider batching with multiple workflow runs.
Yes. Set Stop When (breakCondition) on the Loop block. The loop checks it after each item and stops once it is true; the items already processed keep their results. To skip individual items without stopping, use a Condition block inside the loop instead.
Loopfour