Contents

If

if · Nodes · Control

Routes execution based on a boolean condition.

Conditional routing based on JavaScript truthiness. Routes the input to either then or else based on a configurable condition expression.

Config:

  • condition - JavaScript expression that evaluates to truthy or falsy (default: inputs.input)

Inputs:

  • input - value to evaluate and route

Outputs:

  • then - receives the input value when condition is truthy
  • else - receives the input value when condition is falsy

Behavior: The inactive branch ends there: it emits a skip naming the condition result, so nothing downstream of it runs and the editor fades that connection out. Uses JavaScript truthiness rules where null, undefined, false, 0, "", and NaN are falsy. Objects and arrays are always truthy.

Example:

// Condition: inputs.input.score > 50
// Input: { "score": 75 }
// Result: then output receives the object, the else branch ends

// Condition: inputs.input.length > 0
// Input: []
// Result: else output receives the array, the then branch ends

Related Nodes:

  • selector - Routes based on exact key matching (multiple cases)
  • switch - Routes based on numeric index expression

Inputs

  • inputRequired

Outputs

  • then
  • else

Configuration

FieldTypeRequiredDescription
conditioncode(javascript)NoJavaScript expression to evaluate. Access input via inputs.input. Example: inputs.input.score > 50
base_configrecordNoShared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow).