Switch
Multi-branch routing based on the value of an expression. Each case routes the flow to a different branch. A default (fallback) case captures unexpected values.
Parameters
| Parameter | Type | Required | Variable | Description |
|---|---|---|---|---|
switchExpression | dynamic value | Yes | Yes | Expression to evaluate for branching. Each item is compared against the defined cases. |
cases | array | Yes | No | List of cases. Each case has an id, label, comparison operator, and value. |
options.fallback | choice (none, extraOutput, firstOutput) | No | No | Behavior when no case matches: discard, route to a fallback output, or route to the first case. (Default: "extraOutput") |
options.itemMode | choice (each, first, all) | No | No | Processing mode: evaluate each item individually, route based on the first item, or route if all items match. (Default: "each") |
options.matchStrategy | choice (firstMatch, allMatches) | No | No | Match strategy: stop at the first matching case, or send to all matching cases. (Default: "firstMatch") |
options.typeValidation | choice (strict, loose) | No | No | Type validation: strict (error on incompatible types) or loose (automatic conversion). (Default: "loose") |
options.ignoreCase | boolean | No | No | Ignore case when comparing text values. (Default: false) |
outputVariable | text | No | No | Output variable name for the branching result. |
Parameters marked Variable = Yes accept the
{{blockName.field}}syntax.
Output
Output variable : switchResult
{
"matchedCase": "..."
}
Example
Route the flow based on the request type.
Input :
{"type": "urgent"}
Output :
{"matchedCase": "urgent"}
Tip
{{switchResult.matchedCase}} contains the name of the selected case. If no case matches, the flow goes through the "fallback" branch.