Conditional Node (If Condition)
The Conditional Node introduces branching logic into your workflows.
It evaluates a series of defined conditions in order and routes input data to different outputs based on the first true condition. If none are met, data is sent to the default output.
Purpose
- Dynamic Routing: Route data or execution flow based on content or state.
- If/Else If/Else Logic: Classic conditional branching, no code required.
- Scenario Handling: Separate paths for different outcomes or node results.
- Filtering: Gate data to control which path it follows.
Configuration
Supported properties:
Property | Type | Description | Default |
---|---|---|---|
label | string (optional) | Descriptive name for this node. | 'If Condition' |
conditions | Array<ConditionRule> | Ordered list of condition rules to evaluate. | [{ id, expression, outputHandleId }] |
defaultOutputHandleId | string (optional) | Used if no condition is true. | 'default' |
ConditionRule Structure
Each object in conditions
should have:
id
: string — Unique rule identifier.expression
: string — Boolean expression to evaluate.outputHandleId
: string — Output handle if true.
Expression Syntax and Context
Important: Expression syntax and available context should be documented:
- Variables:
input
for node input,flowData.variable
for flow context, etc. - Syntax: e.g. JavaScript boolean, DSL, JSONPath.
- Examples:
input.temperature > 30
input.status === 'COMPLETED'
flowData.userRole === 'admin'
Inputs and Outputs
Input:
Left handle – receives data to be evaluated.
Outputs:
Right handles – one per ConditionRule
(outputHandleId
), plus one for defaultOutputHandleId
.
- Only one output triggers per run: first true condition or default.
Execution Logic
- Input data arrives at the node.
- Iterate over
conditions
in order. - Evaluate each
expression
with context. - First true: route input to matching
outputHandleId
, stop further checks. - If all false: route input to
defaultOutputHandleId
.
Order matters: Place more specific rules first, general last, to avoid overlaps.
Example: Routing by Order Value
Input:
{ "orderId": "123", "value": 150, "status": "pending" }
Configuration:
- label: Order Value Router
- conditions:
- { id: 'c1', expression: 'input.value >= 100', outputHandleId: 'highValue' }
- { id: 'c2', expression: 'input.value >= 50', outputHandleId: 'mediumValue' }
- defaultOutputHandleId: lowValue
Flow:
input.value
is 150 → highValue output.- 75 → mediumValue output.
- 25 → lowValue output (default).
Notes and Considerations
- Expression Validity: Ensure valid expressions to prevent runtime errors.
- Clarity: Use descriptive
outputHandleId
names. - No Side Effects: Expressions must be pure.
This node gives you powerful, flexible control over workflow logic and data direction.
Loading search features...