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:

PropertyTypeDescriptionDefault
labelstring (optional)Descriptive name for this node.'If Condition'
conditionsArray<ConditionRule>Ordered list of condition rules to evaluate.[{ id, expression, outputHandleId }]
defaultOutputHandleIdstring (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'
Check backend docs for exact evaluation logic.

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

  1. Input data arrives at the node.
  2. Iterate over conditions in order.
  3. Evaluate each expression with context.
  4. First true: route input to matching outputHandleId, stop further checks.
  5. 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:
    1. { id: 'c1', expression: 'input.value >= 100', outputHandleId: 'highValue' }
    2. { 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...