Logic
Nodes in the Logic section control scenario branching and choose which execution path should run next.
1. Condition
Condition evaluates a JavaScript boolean expression and routes the scenario through either the True or False branch.
Use Condition when you need to:
- check a variable value;
- evaluate an HTTP request result;
- branch by status, number, or text value;
- combine several checks in one expression;
- choose a different next step based on the result.
Settings
| Field | Meaning |
|---|---|
Expression |
JavaScript boolean expression or an expression in {{ expression }} form |
TrueAction |
Transition used when the result is true |
FalseAction |
Transition used when the result is false |
NextAction |
Internal fallback when the selected branch is empty |
The main Condition DTO does not expose NextAction, so in the editor it is better to explicitly connect both visible branches: True and False.
Connections
- Input: one standard connector.
- Outputs:
TrueandFalse. TrueActionis used when the expression evaluates to a true result.FalseActionis used when the expression evaluates to false.- If the selected branch is empty, the backend may use the internal
NextActionfallback. - If neither the selected branch nor the fallback is set, the execution has nowhere to continue.
Expressions
Condition.Expression accepts a raw JavaScript expression:
#node.12.http.statusCode == 200 && #node.12.http.isSuccess
or an expression wrapped in a single outer {{ ... }} pair:
{{ #node.12.http.statusCode == 200 && #node.12.http.isSuccess }}
Helper functions can also be used:
parseJson(#node.12.http.rawBody).items.length > 0
How the result is evaluated
The expression result is converted to boolean.
These values are treated as false:
""
0
false
no
null
undefined
NaN
These values are treated as true:
non-zero number
true
yes
any other non-empty string
Objects and arrays are not converted directly to boolean. Check a specific property or length instead.
Output variables
After execution, Condition creates:
#node.{id}.condition.result
#node.{id}.condition.action
If evaluation fails, it may also create:
#node.{id}.condition.error
condition.result contains True or False, while condition.action contains the action selected for the branch.
Example
HTTP Request
-> Condition "#node.12.http.isSuccess"
| True -> Screen "Success"
| False -> Screen "Something went wrong"
Example using JSON response data:
parseJson(#node.10.http.rawBody).order.status === "paid"
Important details
- A missing
#varbecomesnulland normally evaluates tofalse. - An empty expression, invalid JavaScript syntax, or a runtime exception creates an execution error and stops the scenario.
- A
Conditionerror does not automatically route execution to theFalsebranch. - Expressions containing
;are rejected as disallowed statements. - Objects and arrays cannot be used as a direct boolean result — check a specific property or
.length. - HTML entities inside the expression are decoded, so editor-saved
>is executed as>. - Each expression has a
100 mstimeout, a maximum of50statements, and recursion depth5. Conditioncan be used in a synchronous AI tool.
2. Switch
Switch (SwitchNode) routes a scenario by exact values of one expression. Use it instead of a chain of Condition nodes when one variable or template result should lead to several possible branches.
Settings
| Field | Meaning |
|---|---|
ValueTemplate |
Value to compare; supports #var and {{ JS }} |
Cases[] |
List of cases: static Value text plus Action transition |
NextAction |
Default branch when no case matches |
Connections
- Input: one standard connector.
- Outputs: one output for each case, plus
NextActionas the default branch. - Comparison is exact and case-sensitive.
- The first matching case wins; duplicate values are allowed.
- A matched case with an empty action falls back to
NextAction. - If no case matches and
NextActionis empty, execution has nowhere to continue and fails.
Output variables
After execution, Switch creates:
#node.{id}.switch.result
#node.{id}.switch.action
switch.result contains True when a case matched and False when the default branch was used. switch.action contains the selected action.
Example
Switch "#node.7.city"
| "Kyiv" -> Screen "Kyiv branch"
| "Lviv" -> Screen "Lviv branch"
| default -> Screen "Other regions"
Important details
- Editing cases replaces the whole cases list.
- A case
Valueis static text and does not pass through the template renderer. Switchis not used in a synchronous AI tool.