If / Elseif / Else
If / Elseif / Else
Section titled “If / Elseif / Else”Type: if · Package: Core Activities v1.0.8
Makes a decision: evaluates a condition and, depending on whether it is true or false, runs one group of activities or another. It is the basis of the logic of any automation — “if the total exceeds the limit, request approval; otherwise, continue”.
It supports chained conditions: the main one (if), one or more intermediate ones (elseif) and a default one (else).
How it works
Section titled “How it works”- Evaluates the main condition. If it is true, runs the
thenbranch and ends. - If it is false, evaluates each
elseifcondition in order. The first one that is true runs its branch and ends. - If none is met, runs the
elsebranch (if there is one). Withoutelse, the flow simply continues.
Only one branch runs: the first one whose condition is true. The conditions of the following branches are not even evaluated.
How the condition is evaluated
Section titled “How the condition is evaluated”The condition accepts two forms:
- Visual builder: one or more column · operator · value rows, combined with AND (all must be met) or OR (one is enough). The column is read as an expression (for example
totalorrow["Status"]); the value is what it is compared with. A group with no rows counts as false. - Free expression: any C# expression that returns true or false (e.g.
attempts < 3 && !done). An empty value (null) counts as false; a text must betrueorfalse; a number other than 0 counts as true.
Visual builder operators:
| Operator | It is met when… |
|---|---|
equals / not-equals | The values are equal / different. If both look like numbers, they are compared as numbers; otherwise as text, case-insensitive. |
contains / starts-with / ends-with | The text contains / starts with / ends with the value, case-insensitive. |
greater-than / less-than / greater-or-equal / less-or-equal | Numeric comparison. Both sides must be numbers; otherwise the activity fails. |
is-empty / is-not-empty | The field is empty (or only whitespace) / has content. They take no value. |
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
condition | bool | — | Condition to evaluate: visual builder or a boolean expression. E.g. total > 1000. |
Optional parameters
Section titled “Optional parameters”None.
Sub-flows
Section titled “Sub-flows”These parameters are activity blocks configured as lanes on the canvas, not as text.
then required
Section titled “then required”Activities that run when the condition is true.
elseif optional
Section titled “elseif optional”List of intermediate branches, each with its own condition and then, evaluated in order when the main condition is false. They are not edited in the properties panel: the canvas shows them as lanes (“elseif 1”, “elseif 2”…) when the playbook has them. To chain conditions from the canvas, the most direct way is to nest another If inside else.
else optional
Section titled “else optional”Activities that run when no condition was met.
Output
Section titled “Output”This activity does not return a value.
Example
Section titled “Example”Classify an invoice by its amount:
If condition = num(row["Total"]) > 1000000 ├─ then: │ Log level = warning message = "High invoice: requires approval" │ Set Variable name = requiresApproval value = true └─ else: Log level = info message = "Invoice within the limit"Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Value '…' is not numeric. / Comparison value '…' is not numeric. | A numeric operator in the visual builder received a text (the field or the value). Convert 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 (status == "Pending"). |
The condition always goes to else | You compared table cells with == directly. Wrap them in str(...)/num(...) or use eq(a,b). |
Related activities
Section titled “Related activities”- While — repeat while a condition is true.
- Try / Catch — branch on whether something fails, not on a condition.
- Expressions — write the condition.