Loop Node
Iterate over a collection stored in a workflow variable, executing the loop body for each item.
Key Capabilities
- Iterates over any array-type workflow variable — supports arrays of objects, strings, numbers, or mixed types.
- Injects
current_index(0-based integer) andcurrent_item(the element value) into the execution memory for each iteration, making them available to all nodes in the loop body. - Uses materialised iteration — the full array is read once before iteration begins, preventing issues with collections that change during processing.
- Compatible with Break and Continue nodes inside the loop body for fine-grained flow control within iterations.
- The done port fires after all iterations complete or after a Break exits the loop — providing a clean post-loop continuation point.
- Each iteration executes the full body subgraph sequentially — nodes in the body can safely read and write workflow variables accumulating results across iterations.
- Gracefully handles empty arrays — the body port never fires, and execution proceeds directly to the done port without error.
Business Benefits
The ability to process collections of business objects is essential to virtually every enterprise workflow. Payroll runs process each employee. Order fulfilment processes each line item. Bulk email campaigns send to each recipient. The Loop node provides a structured, reliable mechanism to iterate over these collections inside a workflow without requiring custom code or external orchestration.
By keeping iteration logic inside the workflow graph, teams gain full visibility into what happens at each step of the loop. Loop body nodes appear in workflow execution logs with their per-item context, making it straightforward to trace exactly what happened for each element — invaluable when debugging issues in bulk operations.
The materialised list approach ensures consistency throughout the iteration. If upstream logic modifies the source collection after the Loop node has started, those changes do not affect the current run. This prevents a class of subtle bugs where mid-loop data changes cause unpredictable iteration counts or skipped items.
Combined with the Break and Continue nodes, the Loop node supports sophisticated iteration patterns — early exit when a condition is met, skipping invalid items, and accumulating results — all without any imperative code, using only the visual workflow graph.
Use Cases
Process Each Invoice Line Item
An accounts payable workflow loops over the array of line items extracted from a scanned invoice. For each item, it validates the product code against the catalogue, applies the appropriate tax rate, and accumulates a running total. After the loop, the done port triggers the final invoice approval step with all line items validated.
Send Emails to a Recipient List
A bulk notification workflow loads a list of recipients into a workflow variable and loops over it. For each recipient, personalised email content is generated using the recipient's name and preferences, then dispatched via the email integration node. The loop's done port triggers a completion notification to the campaign manager.
Validate Each Product in a Cart
Before checkout, a cart validation workflow loops over the items array. For each item, it checks current stock availability via an inventory API. If any item is out of stock, a Break node exits the loop early and routes to a stock-alert page. If all items pass, the done port proceeds to payment processing.
Process Each Employee in a Payroll Batch
A payroll automation workflow loops over the list of employees scheduled for the current pay period. For each employee, it calculates gross pay, deductions, and net pay based on their contract and time records, then generates a payslip document. The done port triggers the final bank transfer batch submission.
Apply Discounts to Each Order Item
A promotions engine loops over order items to apply product-specific discounts. For each item, it checks whether an active promotion applies to the product category, calculates the discount amount, and updates the item's price field in the execution context. The loop accumulates total savings for display on the order summary.
In This Guide
Configuration
Configure the items variable name and understand how the loop injects per-iteration context into the execution memory.
Input & Output
Body and done port behaviour, per-iteration data injection, Break/Continue signal handling, and data accumulation patterns.
Examples
End-to-end loop configurations for invoice processing, email dispatch, cart validation, and early-exit patterns.