Blocks & Flow EditorCommon

while loop

Repeat flow execution while a condition expression evaluates to true

The while loop block repeats the connected path while a condition expression evaluates to true. When the condition is false (or max iterations exceeded), the flow exits from the false output.

Bot Studio while loop block configuration

Configuration

FieldDescription
NameOptional display label. Defaults to the condition expression if empty.
ConditionJavaScript-like expression evaluated each iteration. Can reference msg, and use flow.get("key") / global.get("key"). Loop continues while this returns true.
Break out after N timesSafety limit — exit the loop after the specified number of iterations even if the condition is still true (default 10000). Prevents infinite loops.
KeyVariable storing the current loop count (msg, flow, or global). Required when the iteration limit is enabled. Auto-generated if blank.

Outputs

PortLabelDescription
LowertrueFires while condition is true — connect loop body here
UpperfalseFires when condition is false or iteration limit reached

Notes

  • Ensure the condition eventually becomes false, or enable the iteration limit
  • Access flow context: flow.get("retries") < 5
  • Combine with delay blocks inside the loop when polling external systems
  • Modifying condition variables incorrectly inside the loop can cause infinite execution
On this page

On this page