Choice

Use a Choice step to branch an automation based on a JSONata condition.

Overview

A Choice step evaluates one or more branches in order and follows the first one whose condition is true. Each branch can contain its own sequence of steps, allowing you to handle different scenarios within a single automation.


Configuration

Branches

A Choice step starts with a single branch, and each branch has:

  • Label (optional): a short name for the branch, shown on the workflow canvas so you can tell branches apart at a glance
  • Condition: the JSONata expression that must evaluate to true for this branch to run. You can author it in either of two modes:
    • Builder mode (the default): a no-code editor for building a condition from a field, operator, and value, with no expression syntax to write
    • Expression mode: write the JSONata expression directly
    • Click Use expression → to switch a branch’s Condition from Builder to Expression mode, or Use builder → to switch back (only offered when the current expression can be represented in the builder)
  • Then go to: the step this branch continues to if its condition is true. You can point this at an existing step, or create a new one on the spot, including the special option End successfully (Succeed), which creates a new Succeed step and ends the branch there without running any further steps

The condition has access to all variables in scope at that point in the workflow:

Namespace What it contains
$trigger Variables exposed by the trigger (see Triggers)
$actionName Output of any preceding action step, where actionName is the step’s identifier
$variableName A named variable assigned by any preceding Variables step, where variableName is the name defined in that step

Multiple branches

Click + Add branch to add another branch. Branches are evaluated top to bottom, and the first one whose condition is true is followed: so the second and later branches behave like else if conditions, and the builder separates them with an Else If label.

Default branch

Enable Include else (default) branch to add a catch-all branch, labeled Else (Default), that runs when none of the other branches’ conditions are true. The default branch has no Label or Condition of its own: just its own Then go to target.

On the workflow canvas, a branch’s edge is labeled with its Label if one is set, otherwise a truncated version of its condition; the default branch’s edge is always labeled Else.


Expression examples

Goal Expression
Branch on insert vs. update $trigger.operation = 'Insert'
Check whether a field has a value $trigger.current.AccountId != null
Check a field value $trigger.current.Status = 'Pending'
Check whether a field changed $trigger.previous.Priority != $trigger.current.Priority
Use the result of a previous action $getRecord.result.data.IsActive = true
Use a workflow variable $shouldNotify = true
Combine conditions $trigger.current.Type = 'Break Fix' and $trigger.current.Priority = 'High'

See also

  • JSONata expressions: expression syntax reference
  • Triggers: trigger output available in conditions
  • Variables: assign named values for use in conditions and other steps
  • Actions: the operations you can run inside each branch