Docs
Sign in

Loop

The Loop node repeats the steps inside it, for each item in a list, while a condition is true, or a set number of times.

Screenshot to add: A Loop node with an each output on the right and a done output at the bottom, and its settings panel.

The palette describes it as "Iterate over items".

When to use it

Use it when the same work must happen many times. For example, send a message to every contact in a list.

Settings

FieldWhat it doesNotes
Loop modeHow the loop decides to repeatFor each (iterate over list) (default), While (condition-based) or Repeat N times
Iterator expressionAn expression that returns the listOnly for For each. Placeholder {{ output.items }}
While conditionThe loop continues while this is trueOnly for While. Placeholder {{ output.has_more }}
Repeat countHow many times to runOnly for Repeat N times. Default 5, range 1 to 1000
Loop variable nameThe name that holds the current itemDefault item
Max iterations (safety cap)An upper limit on repeatsDefault 100, range 1 to 10000
Output keyThe name the results are stored underDefault loop_results
Collect all iteration resultsGathers the result of every passOn by default

Inputs and outputs

HandleWherePurpose
InputTopThe step that comes before
loop-body (labelled "each")RightConnect the steps to repeat here
doneBottomThe path followed after the loop has finished

The node card shows the loop variable and the max iterations.

Example

This is an illustrative example. You want to process a list of invoices.

  1. Set Loop mode to For each (iterate over list).
  2. Set Iterator expression to {{ output.items }}.
  3. Connect the each output to the steps that handle one invoice, using the item variable.
  4. Connect the done output to the step that runs once everything is processed.

Tips

  • Keep Max iterations (safety cap) at a sensible value so a mistake cannot make the loop run for a very long time.
  • Turn off Collect all iteration results if you do not need the output, so less data is kept.
  • A While loop needs something inside it to eventually make the condition false.