Conditional Node Settings
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
.
- Example:
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
.
- Example:
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.
Node Label:
Check HTTP Status Code
Conditions:
Condition 1:
- Expression:
{{apiResponse.status}} == 200
- Output Handle ID:
on_success
- Expression:
Condition 2:
- Expression:
{{apiResponse.status}} == 401
- Output Handle ID:
on_unauthorized
- Expression:
Condition 3:
- Expression:
{{apiResponse.status}} == 500
- Output Handle ID:
on_server_error
- Expression:
Default Output Handle:
on_other_error
Example Outcome
In this scenario:
- If the status is
200
, the flow will continue through theon_success
handle. - If the status is
401
, it will continue throughon_unauthorized
. - If the status is
500
, it will continue throughon_server_error
. - For any other status code, the flow will follow the path defined by
on_other_error
.