Skip to content

Flow rules and return values

Rules run in order; the first match returns its value. else is optional and must be last. If nothing matches and there’s no else, the run fails.

flow:
- when: urgent.probability >= 0.85
do: return
value:
route: escalation
- when: department.value == "billing"
do: return
value:
route: billing
- else:
do: return
value:
route: support

Each when compares one decision field with a string, number or boolean, using ==, !=, >, >=, < or <=. Ordered operators need numbers. Strings use double quotes.

There’s no and/or, code, loops or actions. Use several simple rules in priority order.

value can be any JSON: objects, arrays, strings, numbers, booleans or null.

A string that is exactly one reference is replaced with that field’s value, keeping its type:

value:
route: "{{ department.value }}"
accepted: "{{ department.accepted }}" # stays a boolean

This works inside nested objects and arrays. Partial strings like "Route to {{ department.value }}" are rejected. Unknown references fail validation; unavailable metadata fails at run time.