Conditional Node Settings

The Conditional Node settings panel allows you to define branching logic in your workflow.

Based on one or more conditions, the flow can take different paths.

Configuration

Node Label

  • Description: A descriptive name for the conditional node.
  • Example: "Check User Status", "Verify HTTP Response".
  • Usage: Helps identify the node's purpose on the flow canvas.

Conditions

Conditions are evaluated from top to bottom. The first condition that evaluates to true will determine the flow's output path.

Each condition consists of:

  • Enable/Disable Checkbox: Allows you to activate or deactivate a specific condition without deleting it.

  • Expression: The conditional logic to be evaluated. You can use flow variables using double curly brace syntax, for example, {{variableName}} == "value".

    • Example: {{status}} == 200, {{userData.isAdmin}} == true.
  • Output Handle ID: The identifier of the output point (handle) that will be activated if the expression is true. This ID must match the ID of an output handle defined on the node.

    • Example: success, failure, is_admin_handle.
  • Delete Button: Allows you to remove the condition.

Add Condition

You can add multiple conditions by clicking the button located below the list of conditions.

Default Output Handle

  • Description: The ID of the output handle that will be used if none of the previously defined conditions evaluate to true.
  • Example: default_path, fallback_handle.
  • Usage: Ensures that the flow always has a path to follow even if no specific condition is met.

Usage Example

Imagine a flow that calls an API and then needs to take different actions based on the HTTP status code of the response.

  1. Node Label: Check HTTP Status Code

  2. Conditions:

    • Condition 1:

      • Expression: {{apiResponse.status}} == 200
      • Output Handle ID: on_success
    • Condition 2:

      • Expression: {{apiResponse.status}} == 401
      • Output Handle ID: on_unauthorized
    • Condition 3:

      • Expression: {{apiResponse.status}} == 500
      • Output Handle ID: on_server_error
  3. Default Output Handle: on_other_error

Example Outcome

In this scenario:

  • If the status is 200, the flow will continue through the on_success handle.
  • If the status is 401, it will continue through on_unauthorized.
  • If the status is 500, it will continue through on_server_error.
  • For any other status code, the flow will follow the path defined by on_other_error.