The Loop node runs a while or until loop. It repeatedly executes its loop body (the first outgoing connection) while a JavaScript condition evaluates to true (or false for until mode).
This is different from a simple “for each item” iterator — you control continuation with an expression and typically advance state inside the loop body.
Configuration
| Field | Description |
|---|---|
| Loop type | while — continue while condition is true; until — continue while condition is false |
| Condition | JavaScript expression evaluated each iteration (supports {{templates}}) |
Connections
A Loop node has two outputs:
| Output | Connects to |
|---|---|
| First (loop body) | Node(s) run each iteration — often re-invoked until the condition stops the loop |
| Second (after loop) | Node(s) run once when the loop exits |
Example:
Filter → Loop ──(body)──→ Pick Next Contact
└──(done)──→ Contact Found?
Condition examples
Scan until a contact is ready
Used in sheet outreach templates — keep scanning until someone is due or all rows are checked:
(() => {
const contacts = Array.isArray(variables.contactList) && variables.contactList.length
? variables.contactList
: ({{context['due-for-sequence'].output}} ?? []);
const s = {{context['pick-next-contact'].output}};
if (s && typeof s.index === 'number') return !s.done && s.index < contacts.length;
return contacts.length > 0;
})()
Use the Variables picker to insert correct node IDs for your workflow.
Limit iterations
loopIndex < 10
While a variable flag is set
variables.keepGoing === true
Scope inside the loop
During each iteration, the loop body nodes can read:
| Reference | Contents |
|---|---|
lastOutput | Output from the previous step in that iteration |
variables | Workflow variables (including contactList, scanIndex in sequence workflows) |
context | Per-node outputs: context['node-id'].output |
inputs | Original trigger data |
After the loop body runs, the condition is re-evaluated.
Loop + Restart from node
For multi-contact email runs, the pattern is:
- Loop scans the list (body = Scan Sequence Contact).
- After send + sheet update, Patch Sequence Scan updates in-memory state.
- Restart from node on the patch step jumps back to the Loop without re-reading the sheet.
See Transform Catalog → Sheet outreach pattern.
Tips
- The loop body node often has no outgoing edge — the loop re-invokes it directly.
- Put Filter steps before the loop, not inside it, when possible.
- Guard conditions against empty arrays to avoid infinite loops.
- Check Execution Data on the loop node to see
shouldContinueafter each iteration. - For very large lists, add a max-iteration guard in the condition.
Related
- Transform Catalog — Scan Sequence Contact, Patch Sequence Scan
- Condition — branch after the loop exits
- Execution → Restart from a node