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) |
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