Conditional Node

Overview

The Conditional node branches workflow execution based on conditions you define. It evaluates multiple choices in order and executes the first matching branch. Each choice can have its own set of nodes that execute when the condition is met.

When to Use

Use a Conditional node when you need to:

  • Branch based on data values (e.g., if price > 100)
  • Check user permissions or roles
  • Validate data before proceeding
  • Handle different scenarios (e.g., approved vs rejected)
  • Route workflows based on computed results
  • Implement switch/case logic with multiple branches

Configuration

Choices

Each choice represents a potential execution path:

  • Name: Descriptive name for the choice
  • Conditions: Rules that must be met for this choice to execute
  • Branch: The nodes that execute when this choice matches
  • First Node: The starting node in this choice’s branch

Choices are evaluated in order - the first matching choice will execute.

Normal Mode vs Developer Mode

Normal Mode: Visual condition builder

  • Select field using JSONPath picker (e.g., $.results.nodeId.field)
  • Choose data type (String, Numeric, Boolean, Timestamp)
  • Select comparison operator
  • Enter comparison value
  • Add multiple conditions (implicitly AND’ed together)

Developer Mode: JSONata expressions

  • Write custom JSONata expressions for complex logic
  • Use $results.nodeId.field syntax (note: no dot after $)
  • Full access to JSONata operators and functions
  • More flexible but requires understanding JSONata syntax

Comparison Operators

For all types:

  • Equals: Value exactly matches
  • IsNull: Value is null or undefined
  • IsPresent: Value exists (not null/undefined)

For Numeric and Timestamp:

  • > (GreaterThan): Value is greater than
  • >= (GreaterThanEquals): Value is greater than or equal to
  • < (LessThan): Value is less than
  • <= (LessThanEquals): Value is less than or equal to

For String only:

  • Contains: String contains the value (substring match)

Default Path

Optional fallback path that executes when no choices match. If not defined, the workflow will end when no conditions match.

Examples

Example: Simple Comparison

Node ID: checkAge

Choice 1: “Adult”

  • Condition: $.results.getUserInfo.age (Numeric) >= 18
  • First Node: showAdultContent

Default Path: showAgeRestriction

Example: Multiple Conditions

Node ID: validateUser

Choice 1: “Valid User”

  • Condition 1: $.results.getUser.verified (Boolean) Equals true
  • Condition 2: $.results.getUser.status (String) Equals active
  • First Node: grantAccess

Default Path: denyAccess

This uses implicit AND logic - both conditions must be true.

Example: Priority Routing

Node ID: routeOrder

Choice 1: “Rush Orders”

  • Condition: $.results.order.priority (String) Equals rush
  • First Node: expediteProcessing

Choice 2: “High Value”

  • Condition: $.results.calculateTotal.total (Numeric) > 1000
  • First Node: managerApproval

Choice 3: “Standard”

  • Condition: $.results.order.priority (String) Equals standard
  • First Node: standardProcessing

Default Path: handleUnknownPriority

Example: String Matching

Node ID: checkCategory

Choice 1: “Electronics”

  • Condition: $.results.product.category (String) Contains electronic
  • First Node: processElectronics

Choice 2: “Clothing”

  • Condition: $.results.product.category (String) Contains apparel
  • First Node: processClothing

Default Path: processGeneral

Example: Developer Mode (JSONata)

Node ID: complexLogic

Choice 1: “Premium Eligible” (Developer Mode)

  • Condition Expression:
    $results.user.age >= 18 and $results.user.verified = true and ($results.order.total > 500 or $results.user.isPremium = true)
  • First Node: offerPremiumFeatures

Choice 2: “Standard User” (Developer Mode)

  • Condition Expression:
    $results.user.verified = true
  • First Node: standardFlow

Default Path: requireVerification

JSONata Expression Syntax

When using Developer Mode, you can write JSONata expressions. JSONata is a lightweight query and transformation language.

Data Access

$results.nodeId.field              // Access field from node output
$results.nodeId.nested.field       // Access nested field
$trigger.inputField                // Access trigger input

Comparison Operators

$results.nodeId.field = value      // Equal
$results.nodeId.field != value     // Not equal
$results.nodeId.field > value      // Greater than
$results.nodeId.field >= value     // Greater than or equal
$results.nodeId.field < value      // Less than
$results.nodeId.field <= value     // Less than or equal

Logical Operators

condition1 and condition2          // Both must be true
condition1 or condition2           // At least one must be true
not(condition)                     // Invert condition

Grouping

(condition1 or condition2) and condition3

String Functions

$contains($results.nodeId.text, "keyword")
$startsWith($results.nodeId.text, "prefix")
$endsWith($results.nodeId.text, "suffix")
$length($results.nodeId.text) > 10

Null/Existence Checks

$exists($results.nodeId.field)     // Field is present
$results.nodeId.field != null      // Field is not null

Number Functions

$number($results.nodeId.stringValue)
$round($results.nodeId.price, 2)

Examples

Multiple conditions:

$results.user.age >= 18 and $results.user.verified = true

Complex logic with grouping:

($results.user.role = "admin" or $results.user.role = "manager") and $results.user.active = true

String checks:

$contains($results.product.name, "Premium") and $results.product.price > 100

Null safety:

$exists($results.user.email) and $results.user.email != ""

Best Practices

  • Order Matters: Place more specific conditions before general ones
  • Test All Paths: Verify each choice and the default path work correctly
  • Use Default Path: Always provide a fallback for unmatched conditions
  • Simple First: Use Normal Mode unless you need complex logic
  • Clear Names: Give choices descriptive names that explain what they check
  • Avoid Overlap: Ensure choices are mutually exclusive when possible
  • Null Safety: Check for null/undefined values before comparing
  • Document Complex Logic: Add comments in workflow description for JSONata expressions

Accessing Choice Output

Conditional nodes don’t produce their own output. To access data from executed branches:

// If "Adult" choice executed and ran processAdult node
$.results.processAdult.result

// If "Standard" choice executed and ran standardFlow node
$.results.standardFlow.orderId

The output depends on which choice’s branch executed.

Common Patterns

Range Checks

Normal Mode:

Choice 1:
  Condition 1: value >= 0
  Condition 2: value <= 10

Choice 2:
  Condition 1: value > 10
  Condition 2: value <= 100

Developer Mode:

$results.nodeId.value >= 0 and $results.nodeId.value <= 10

Status Checks

Normal Mode:

Choice 1: status Equals "completed"
Choice 2: status Equals "pending"
Choice 3: status Equals "failed"

Role-Based Routing

Developer Mode:

$results.user.role = "admin" or ($results.user.role = "manager" and $results.user.department = "sales")

Existence Checks

Normal Mode:

Condition: field IsPresent

Developer Mode:

$exists($results.nodeId.field) and $results.nodeId.field != ""

Nested Branches

Each choice can have its own complex workflow with multiple nodes, including more conditional nodes:

routeOrder
├─ Choice 1: "High Priority"
│  └─ checkInventory (conditional)
│     ├─ Choice 1: "In Stock" → fulfillOrder
│     └─ Default → backorder
├─ Choice 2: "Standard"
│  └─ standardProcessing
└─ Default → handleError