Skip to content

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).

  1. Evaluates the main condition. If it is true, runs the then branch and ends.
  2. If it is false, evaluates each elseif condition in order. The first one that is true runs its branch and ends.
  3. If none is met, runs the else branch (if there is one). Without else, 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.

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 total or row["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 be true or false; a number other than 0 counts as true.

Visual builder operators:

OperatorIt is met when…
equals / not-equalsThe values are equal / different. If both look like numbers, they are compared as numbers; otherwise as text, case-insensitive.
contains / starts-with / ends-withThe text contains / starts with / ends with the value, case-insensitive.
greater-than / less-than / greater-or-equal / less-or-equalNumeric comparison. Both sides must be numbers; otherwise the activity fails.
is-empty / is-not-emptyThe field is empty (or only whitespace) / has content. They take no value.
ParameterTypeDefaultDescription
conditionbool—Condition to evaluate: visual builder or a boolean expression. E.g. total > 1000.

None.

These parameters are activity blocks configured as lanes on the canvas, not as text.

Activities that run when the condition is true.

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.

Activities that run when no condition was met.

This activity does not return a value.

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"
MessageCause 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 elseYou compared table cells with == directly. Wrap them in str(...)/num(...) or use eq(a,b).
  • While — repeat while a condition is true.
  • Try / Catch — branch on whether something fails, not on a condition.
  • Expressions — write the condition.