Loop Node

Repeat a loop body while a JavaScript condition is true — for scanning lists, retries, and multi-contact runs.

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

FieldDescription
Loop typewhile — continue while condition is true; until — continue while condition is false
ConditionJavaScript expression evaluated each iteration (supports {{templates}})

Connections

A Loop node has two outputs:

OutputConnects 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:

ReferenceContents
lastOutputOutput from the previous step in that iteration
variablesWorkflow variables (including contactList, scanIndex in sequence workflows)
contextPer-node outputs: context['node-id'].output
inputsOriginal trigger data

After the loop body runs, the condition is re-evaluated.

Loop + Restart from node

For multi-contact email runs, the pattern is:

  1. Loop scans the list (body = Scan Sequence Contact).
  2. After send + sheet update, Patch Sequence Scan updates in-memory state.
  3. 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 shouldContinue after each iteration.
  • For very large lists, add a max-iteration guard in the condition.