While
Type: while · Package: Core Activities v1.0.8
Repeats a block of activities as long as a condition is true. The condition is evaluated before each pass: if it is false from the start, the block never runs. Use it when you don’t know in advance how many passes you need — it depends on something that changes: “while there are more pages”, “while the queue has items”, “until the balance reaches zero”.
How it works
Section titled “How it works”- Evaluates the condition.
- If it is true, runs the
activitiesand goes back to step 1. - If it is false, it ends and the flow continues.
It supports Break (exit immediately) and Continue (skip to the next evaluation). Before each pass the loop checks whether the execution was terminated, so Terminate stops it between one pass and the next.
The condition is written the same way as in If: with the visual builder (column, operator and value, combined with AND/OR) or with a boolean C# expression. A visual builder with no rows counts as false, so the loop does not enter.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
condition | bool | — | Condition evaluated before each pass. Visual builder or boolean expression. E.g. morePages. |
Optional parameters
Section titled “Optional parameters”None.
Sub-flows
Section titled “Sub-flows”activities required
Section titled “activities required”Activities that run on each pass while the condition is true.
Output
Section titled “Output”This activity does not return a value.
Example
Section titled “Example”Process a queue until it is empty:
Set Variable name = hasItem value = true
While condition = hasItem └─ activities: Queue Get Item queue = "invoices" → output: item If condition = isNull(item) ├─ then: │ Set Variable name = hasItem value = false // nothing left: ends the loop └─ else: Invoke Playbook path = "process.json" input = { invoice: item }Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'activities' is required. | The loop has no activities lane. Add at least one activity inside. |
Value '…' is not numeric. | In the visual builder you used a numeric operator (greater than, less than…) with a field that is not a number. Convert the value with num(...) or use “equals”. |
String '…' was not recognized as a valid Boolean. | The expression returned a text other than true/false. Write a comparison that yields true or false (status == "Pending"). |
| The loop never runs | The condition was already false on entry, or the visual builder has no rows. Check the initial value of the condition’s variables. |
| The execution hangs | Infinite loop: the condition never changes. Make sure the body changes the condition and add a safety cap. |