Blocks & Flow EditorCommon

switch

Route messages to different outputs based on property values and rules

The switch block routes messages to different output ports based on rules applied to a message property. Use it for conditional branching in your flow.

Bot Studio switch block configuration with property and rules Switch block rule operator and value configuration

Configuration

FieldDescription
NameOptional display label on the canvas.
PropertyMessage property to evaluate (e.g. msg.payload, msg.status). Supports msg, flow, global, and JSONata expressions.
RulesList of conditions. Each rule has an operator, comparison value, and maps to one output port. Add rules with + — each rule creates an additional output.
Check all rules / Stop after first matchCheck all rules — message may match multiple outputs. Stop after first match — message is sent only to the first matching output.
Recreate message sequencesWhen enabled, repairs message sequence metadata after routing (useful for sequence-based rules).

Rule operators

OperatorDescription
== / !=Equals / not equals
< / <= / > / >=Numeric comparisons
containsString or array contains value
matches regexValue matches a regular expression
is true / is falseBoolean check
is null / is not nullNull check
is empty / is not emptyEmpty string or array check
is of typeType check (string, number, object, etc.)
has keyObject has the specified key
is betweenValue is within a range
JSONata expCustom JSONata expression
otherwiseDefault catch-all rule (last output)

Outputs

Each rule maps to one output port (left to right). The message is sent to the port(s) whose rules match.

OutputWhen used
Rule 1, 2, 3…One port per rule, in order
OtherwiseWhen no other rule matches (if configured)

Notes

  • Add an otherwise rule as the last rule to handle unmatched messages
  • Use Stop after first match for exclusive branching (if/else-if/else)
  • Property values are compared as strings unless using numeric operators