Docs »

Bots »

Behaviors »

Decisions & Outcomes

A decision represents a point where a behavior needs to choose the best outcome from any number of possible outcomes.

The first outcome to satisfy all of its conditions is chosen. For this reason, the order of outcomes within a decision is very important.

Conditions are criteria like the time of day, day of week, or the comparison of any record field against some value using an operator (e.g. is, is not, greater/less than, between, contains, matches, starts with).

Here’s a simple binary (two outcome) decision:

  • Is it Friday?
    • Yes
    • No

The “Yes” outcome has a single condition that the current day is “Friday”.

The “No” outcome, being last, doesn’t need any conditions because it would be selected on any day other than Friday. We call this a default (or “catch-all”) outcome.

This is comparable to an if...else conditional statement in computer programming.

A slightly more complex variation is:

  • Day of week:
    • Monday
    • Tuesday
    • Wednesday
    • Thursday
    • Friday
    • Saturday
    • Sunday

Similar to the “Yes” example above, each outcome would compare the current day against a specific target day, and the behavior would continue down the path (branch) of the outcome that matched the current day.

This is comparable to a switch statement in computer programming.

While the above examples have a single condition for each outcome out of simplicity, an outcome can have any number conditions, optionally grouped into sets with an any or all constraint.

As you would expect, a set of any conditions need only satisfy one of them. A set of all conditions must satisfy all of them.

Decisions can also be nested within other decisions. Consider the following:

  • Schedule:
    • Holiday
    • Weekend
    • Weekday
      • What time of day is it?
        • Before office hours
        • During office hours
        • After office hours

The above decision tree describes five final outcomes within two decisions. It doesn’t repeat the conditions to check if the current day is a weekday. The same approach can be used to create very complex decisions that are still easy to follow.