For Loop
Overview
The For Loop Process Node allows you to repeat a group of workflow steps multiple times. You define how many times the loop should run using a start value and an end value, or by iterating over a list of items.
This is useful when a task needs to be executed several times, such as sending multiple notifications, performing repeated calculations, or processing multiple items from a database query.
Description
Execute actions repeatedly.
The For Loop node creates a cycle in your workflow. It runs the nodes placed inside it for each iteration until the end condition is met.
Counter Loop
Run a set number of times (e.g., from 1 to 5).
Array Loop
Iterate over a list of items (e.g., process each user in a list).
You can access the current loop variable dynamically within the inner nodes using specific notation.
Input Parameters
The For Loop node accepts settings to define the range or data to iterate over.
StartnumberRequired1EndnumberRequired5StepnumberOptional1Loop VariablearrayOptional"{{fetchData.data}}"Loop Notation:
When iterating over an array, you can access the current item's data using the [] notation.
- Current Item:
{{nodeId.variable[]}} - Specific Field:
{{nodeId.variable[].name}}or{{nodeId.variable[].email}}
Example: If you are looping over a list of users from a node named fetchUsers, you can use {{fetchUsers.data[].email}} in a "Send Email" node inside the loop.
Output Parameters
The node provides a summary of the execution.
iterationsarrayOptional[1, 2, 3, 4, 5]totalIterationsnumberOptional5Final OutputanyOptionalOutput Type
Output Type: Iterative / Array
The node produces an iterative output, meaning it runs the inner steps multiple times. The final output is often an array containing the results from each cycle.
Example Usage
Example 1: Simple Counter
Loop 5 times to create 5 records.
{ "start": 1, "end": 5, "step": 1}
{ "iterations": [1, 2, 3, 4, 5], "totalIterations": 5}
Example 2: Array Iteration
Process a list of 3 users.
{ "start": 0, "end": 2, "loopVariable": "{{fetchUsers.data}}"}
{ "iterations": [0, 1, 2], "totalIterations": 3}
Inside the loop, {{fetchUsers.data[].name}} would resolve to "Alice", then "Bob", then "Charlie".
How to Use in a No-Code Workflow
Add the Node
Drag and drop the For Loop Process node into your workflow.
Set Range
Set the Start and End values. If looping over an array, use the array length or map the array field.
Add Inner Nodes
Place nodes inside the loop container. These nodes will run for every cycle.
Use Loop Variables
In the inner nodes, use the [] notation (e.g., {{nodeId.data[].field}}) to use data from the current iteration.
Run Workflow
Save and run. The workflow will execute the inner nodes repeatedly.
Best Practices
- Test with a small range first (e.g., 1 to 3) to verify logic.
- Always place at least one node inside the loop.
- Use logging nodes inside the loop to debug each iteration.
Do / Don’t
- ✔️ Use the
[]notation to access dynamic data for each item. - ✔️ Ensure your End value is not excessively high to avoid timeouts.
- ✔️ Use Step to skip values if needed (e.g., process every 2nd item).
- ❌ Don’t create infinite loops (Start must be less than End, or logic must terminate).
- ❌ Don’t forget to map the loop variable correctly in inner nodes.
- ❌ Don’t nest too many loops deep as it complicates debugging.
Common Errors
Loop does not runErrorOptionalEmpty OutputWarningOptionalVariable not foundErrorOptionalExample Workflow Integration
Use Case 1: Send Bulk Emails
Send a personalized email to a list of subscribers.
- Fetch Data: Get list of subscribers from database.
- For Loop: Iterate from 0 to
{{subscribers.count}}. - Send Email (Inside Loop):
- To:
{{subscribers.data[].email}} - Body: "Hello
{{subscribers.data[].name}}..."
- To:
- Summary: Log "All emails sent".
Workflow Data Flow:
{{subscribers.data[].email}} → {{sendEmail.to}}
Use Case 2: Process Order Items
Update inventory for each item in an order.
- Trigger: New Order Received.
- For Loop: Iterate over
{{order.items}}. - Update Data (Inside Loop): Decrease stock for
{{order.items[].product_id}}.
Workflow Data Flow:
{{order.items[].product_id}} → {{updateData.query.id}}
