Skip to main content

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

ParameterTypeRequiredVariableDescription
switchExpressiondynamic valueYesYesExpression to evaluate for branching. Each item is compared against the defined cases.
casesarrayYesNoList of cases. Each case has an id, label, comparison operator, and value.
options.fallbackchoice (none, extraOutput, firstOutput)NoNoBehavior when no case matches: discard, route to a fallback output, or route to the first case. (Default: "extraOutput")
options.itemModechoice (each, first, all)NoNoProcessing mode: evaluate each item individually, route based on the first item, or route if all items match. (Default: "each")
options.matchStrategychoice (firstMatch, allMatches)NoNoMatch strategy: stop at the first matching case, or send to all matching cases. (Default: "firstMatch")
options.typeValidationchoice (strict, loose)NoNoType validation: strict (error on incompatible types) or loose (automatic conversion). (Default: "loose")
options.ignoreCasebooleanNoNoIgnore case when comparing text values. (Default: false)
outputVariabletextNoNoOutput 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.