StyloDocs
Workflow blocks

Loop

Iterate over items, a fixed count, or while a condition is true

View as Markdown

system/loop — Iterate over items, a fixed count, or while a condition is true.

Where it appears

The Loop block lives in the Logic & control group of the Workflow Builder.

Fields

FieldTypeRequiredDefaultDescription
loopTypeselectNoforEachHow the loop decides when to stop. For Each iterates over an array, Repeat N Times runs a fixed count, While checks a condition before each iteration, and Do-While runs once before checking. The other fields shown depend on this choice. Options: forEach, forLoop, while, doWhile.
itemstext (multi-line, supports references)YesThe array to iterate over, one iteration per element. Accepts a literal JSON array or a <PreviousStep.field> reference to an upstream array output.
iterationstext (supports references)NoNumber of iterations to run. Accepts a fixed number or <NodeName.field> reference.
conditionconditionsYesBoolean expression evaluated each iteration. Loop continues while truthy. Operators: ===, !==, >, <, >=, <=, !, &&, ||
maxIterationstextNo100Hard cap to prevent infinite loops. Loop exits once this count is reached even if the condition is still true.
errorPolicyselectNostopWhat happens when an iteration throws an error. Stop halts the whole workflow; Continue lets execution proceed down the loop's exit path. Options: stop, continue.

Inputs and outputs

Inputs are the configurable fields above. The block produces these outputs:

Outputs

Reference an output downstream with <Loop.field>.

NameTypeDescription
itemsarrayItems iterated over
iterationsnumberNumber of iterations executed
resultsarrayArray of all iteration results

Example

A minimal configuration for this block:

{
  "type": "system/loop",
  "config": {
    "loopType": "forEach",
    "items": "<PreviousStep.field>",
    "condition": "<PreviousStep.field>",
    "maxIterations": "100",
    "errorPolicy": "stop"
  }
}

Limits and failure modes

  • Required fields (items, condition) must be set, or the block fails validation before it runs.

On this page