Settingsintermediate

Branches and decision trees

How an automation runs different steps depending on what is true — Only if / Then, Otherwise, if, Otherwise, and Every time.

4 min read

Branches and decision trees

Most rules have one path: When something happens, Only if the conditions are true, Then run the steps. Some rules must do different things in different cases. Branches are how one rule chooses between them.

A rule has one trigger but can have many branches. Each branch has its own conditions and its own ordered list of steps.

Add a branch

  1. Open the rule and click More options.
  2. Click Add branch. A new section Otherwise, if opens below the rule, with its own conditions and steps.
  3. Click Add otherwise to add an Otherwise section at the end. It has steps and no conditions, and runs only when no condition above it matched.

Add branch shows when the rule has at least one condition under Only if. To remove a branch, click Remove this branch on it.

How branches are checked

  • Only if / Then — Its conditions are true. With no conditions, the steps run each time the rule runs.
  • Otherwise, if — No branch above it matched, and its own conditions are true
  • Otherwise — No condition above it matched
  • Every time — On every event, whatever matched

Branches are checked from the top down. The first one that matches runs its steps, and the branches after it are not checked. Otherwise is the fallback: it runs only when nothing above it matched. A section shown as Every time is different: it runs on each event, together with whichever branch matched.

The shape of a typical decision tree

A “route by customer tier” rule can look like this:

When: A new conversation starts

Only if: Customer tier is VIP
Then:    Assign conversation to an agent or team → Premium
         Add tag → VIP

Otherwise, if: Subject contains "billing"
Then:          Assign conversation to an agent or team → Billing

Otherwise
Then:          Assign conversation to an agent or team → General

When a new conversation arrives:

  • VIPs go to Premium and get the VIP tag.
  • Other conversations whose subject is about billing go to Billing.
  • Everything else goes to General.

Common patterns

Tier-based routing

Put the most important case in Only if, the next cases in Otherwise, if branches, and the fallback in Otherwise. See VIP routing recipe.

One case only

Use only Only if when the rule does something in one situation. You do not need a branch or Otherwise.

When to split into more rules

Branches keep related logic in one place. But if you have five or six branches that do very different things, separate rules are often clearer. Some guidelines:

  • If two branches use unrelated fields (one checks tags, another checks customer tier), you may have two rules in one.
  • If two branches need a different Limit how often it runs or Only during opening hours, you must split them — those settings are for the full rule, not for one branch.
  • If you cannot say what the rule does in one sentence, it is probably more than one rule.

See also

Tags

Reference