Skip to main content

Branching in Automations

Use Branch steps for even greater flexibility in Custom Automations

Carly Hammond avatar
Written by Carly Hammond
Updated this week

Summary

  • "Branch" is a type of step you can use when configuring Custom Automations

  • Branching enables you to achieve multiple possible outcomes from a single Automation, so you don't need to create lots of separate Automations

  • Branch steps consist of a series of conditions - you define the criteria that determines whether each subsequent branch path of the Automation runs

  • Branch steps are only available in Automations in upgraded Planhat (ws.planhat.com)

Who is this article for?

  • Planhat Users who are building Custom Automations for their organization (e.g. Tech/Ops)

Series

This article is part of a series on Automations:


Article contents

This is a technical deep-dive article

Read on if you'd like to learn about Branch steps - a type of step you can use when configuring Custom Automations. Ensure you read our article on Custom Automations before this one, so you are familiar with the context of where these Branch steps can be used.

If you would simply like a general introduction to Automations, check out our overview article here.


Introduction

Automations are one of the features in Planhat that enable you to automate actions, rather than needing to do everything manually - dramatically increasing efficiency, as well as a variety of other benefits.

We often describe Automations as working on the basic principle of "when x happens, do y", and a typical example could be "when a Company Health Score drops below 6, send a notification". But while some Automations can be simple like this, they actually can be a lot more advanced than this, allowing a great deal of flexibility.

One of your options when building Custom Automations is branching. This means you could have a range of possible processes/outcomes, all from a single Automation. So, your Automation could have the format of "when x happens; if condition A is met, do y; if condition B is met, do z". This is incredibly powerful.

In this article, you will learn all about "Branch" steps in Automations - what they are, why they're useful, and how to set them up.


What are Branch steps?

"Branch" is a step type you can select when configuring a Custom Automation. "Branch" is part of the "Logic and Flow Control" group of actions:

Branch steps enable you to configure a variety of possible outcomes, each with conditions to specify the circumstances when that path of the Automation will run. The Branch step itself consists of the different conditions "gating" the different paths, and then you can build additional steps after that.

The screenshot below shows an example Custom Automation, with the Branch step highlighted in green in the flow chart on the right, and showing in the configuration panel on the left. We'll talk you through the details of this example later in this article.

Click the image to view it enlarged


Why use Branch steps?

Branch steps are perfect for processes with branching logic rather than purely linear logic (i.e. you want the outcome of the Automation to be y and/or z, rather than always y). So, for example, you could use a Branch step for deal routing, such as:

  • When an Opportunity is created ...

  • ... assign it an Owner based on the Company ARR:

    • If the ARR is less than $30,000, assign the SMB Account Executive

    • If the ARR is between $30,000 and $100,000, assign the Mid-market Account Executive

    • If the ARR is more than $100,000, assign the Enterprise Account Executive

There are, of course, a range of possible variations of this - e.g. maybe you assign Opportunities (deals) based on region rather than Company size.

And we're sure you have many of your own additional processes where branching would be useful!

πŸš€ Tip

Your branches don't need to be mutually exclusive (non-overlapping) like in the example above - if multiple conditions match, all relevant branches will run.


How to set up Branch steps

When you are configuring (creating or editing) a Custom Automation (see here for general information on how to do this), you select "Branch" as the type when adding a step:

Once you've selected a Branch step, the Automation editor will look something like this:

Click the image to view it enlarged

It's important to note that the "conditions", as shown in the flow chart on the right, are actually part of the Branch step - so if you've been looking at another part of the Automation and want to view or edit them, you click on the Branch step to show them in the left-hand panel (rather than clicking on the conditions themselves).

As you can see in the example screenshot above, initially the Branch step will show "Condition 1" - here you can specify the details of your first condition. Your condition is a rule, like a filter, to determine when that part (path) of the Automation (i.e. the step(s) shown after this condition) should run.

To configure your conditions:

  1. Click "+ Rule" to open up a row like so:

  2. In the left-hand box, you should specify the property/field you want the criteria to be based on, such as the Company ARR. You need to do this via replacement codes

    πŸš€ Tips

    • To learn all about Automation replacement codes, check out our separate article here

    • Type << in the box to display all your available options (like in the example screenshot above). If you continue typing (e.g. <<object) the options list will filter

    • You can fully type your replacement code, or select it from the list

    • Remember (from the replacement codes article) that "object" refers to the model record in the Automation trigger, and you can also refer to any previous steps by quoting their step names exactly

    • Examples:

      • To reference the Health Score of a Company, where the Company is in the trigger, use <<object.h>>

      • To reference the ARR of an Opportunity, where the Opportunity is in the trigger, use <<object.arr>>

      • To reference the Phase of a Company, where the Company is accessed through a Get step with name "Step 1", use <<Step X.phase>>

  3. Make sure you select the correct property/field type by clicking on the icon on the right of this box. This influences which operators (e.g. "more than") will be available for you to select in the condition

  4. In the middle box of the condition, choose the appropriate operator

  5. Enter an appropriate value to complete your condition

  6. Optionally, if you would like to add another rule as part of your condition, click "+ Rule" to add a new row, which you can complete like you have just done for the first one

    πŸš€ Tip

    Like when building filters elsewhere in Planhat:

    • You can choose between "match all" and "match any"

    • You also have the option of using groups of rules

    Check out this linked article for further details of how to set these up

  7. Optionally, if you would like rename the condition/branch - which can be really useful when you are viewing the overall Automation, and also when looking in the Automation logs - then click into where it says "Condition 1" in the left-hand panel, above the rule(s)

    Click the image to view it enlarged

  8. To define the rule(s) for your next branch path - but note this is still part of the same Branch step - click "+ Add branch" in the left-hand panel

  9. You'll see that this opens up "Condition 2" for you to fill in

    Click the image to view it enlarged

    Complete the condition, following the steps you just saw for the first condition

  10. Repeat steps 8 and 9 for each additional condition / branch path you would like to add

  11. Once you have finished configuring all your conditions - i.e. you have finished configuring the Branch step - then on the flow chart on the right, click on the boxes for each step after a condition to configure it. This is then exactly like adding/configuring any other step when building a Custom Automation, as we describe in detail in this separate article

    Click the image to view it enlarged


Worked example of an Automation with a Branch step

Now you understand the principles of how to create Custom Automations with Branch steps, we'll bring it all together with a complete example of such an Automation.

This is an Automation for deal routing/assignment. When an Opportunity is created, it "Gets" the Company it's associated with, and then updates the Opportunity so its Owner is a particular User (of Planhat) depending on the ARR of the Company. This is useful for a scenario where a different Account Executive (AE) will be responsible for the Opportunity depending the Company "size" (tier/segment).

Click the image to view it enlarged

Let's go through all the component elements of this Automation, clicking on each box in the flow chart in turn to open up its configuration panel on the left-hand side.

Trigger - "Opportunity created"

The Automation is triggered whenever an Opportunity is created.

This is set to "created with anything", without any trigger filtration, because we want the Automation to trigger whenever an Opportunity record is created.

Click the image to view it enlarged

"Get a single Company" step

Because we want to use information in the Company record that's associated with the Opportunity record that triggered the Automation (e.g. the trigger record could be the "Data Backup" Opportunity that's been created for the Company "GSK"), we need a "Get" step to retrieve that Company.

We identify the relevant Company via the "companyId" field on the Opportunity model/record (the "object"), so we use the replacement code <<object.companyId>>. To learn more about Automation replacement codes, check out our separate article here.

Click the image to view it enlarged

Branch step - looking at Company ARR

Next, we have the actual Branch step. This Branch step has 3 different conditions, each looking at a different Company ARR range.

Click the image to view it enlarged

Let's zoom into the conditions in this Branch step:

For all of these, in the left-hand box we use the replacement code <<s-Bgi.arr>> to refer to the "arr" property (field) on the record in the "Get Company" step, which we did not rename from automatically generated step name, and in this case is "s-Bgi". If we had renamed that "Get Company" step from "s-Bgi" to "Step 1", for example, then our replacement code would have been <<Step 1.arr>> instead.

Other points to note:

  • In this example, we have renamed "Condition 1" to "SMB Deal", "Condition 2" to "MM Deal", and "Condition 3" to "Ent deal". This is primarily so it's clear what the different branch paths are when looking at the flow chart, but it also makes it clearer when viewing the Automation logs, which we discuss at the end of this article

  • The "123" next to each replacement code in the screenshot denotes that we have specified that the property in question ("arr") is a number field

  • Technically, the numerical ranges in the right-hand boxes in this screenshot should be adjusted slightly, to ensure no value can fall between the ranges

3 x "Update Opportunity" steps

Finally, underneath the 3 conditions of the branch step, there are 3 separate steps to update the Opportunity, assigning an Owner based on the Company ARR. Remember, which of these 3 steps runs will depend on which of the conditions are met.

Click the image to view it enlarged

All of these steps have the same format, so we'll look at the configuration panel of one of them to explain them all.

Initially in the step we have specified that we want to update an Opportunity - so far, so simple!

Next to the mandatory, grayed-out "id" box, we use the replacement code <<object._id>> to specify which Opportunity we want to update - since "object" in this Automation refers to the Opportunity triggering the Automation, and "_id" is its Planhat ID, this line simply says that we want to update the Opportunity in the trigger.

In the line underneath, we have chosen the "Owner" field on the Opportunity from the dropdown menu, and then chosen a Planhat User (i.e. you and your teammates) from the User picker - in this case we have chosen Aretha, because she is our Account Executive who's responsible for SMB Companies.

Finally, we have renamed the step to "Update Owner to SMB AE". While renaming the step is optional, it makes the steps clearer in the Automation flow chart, as well as in the logs (as we will discuss in the next section).


Viewing the logs of branching Automations

We have a separate article on Automation logs here, but here let's focus on logs for Automations with a Branch step. We'll show the logs for the Automation we just talked through in the previous section of this article.

Click the image to view it enlarged

As usual with Automation logs, successful steps are shown in green.

At this level (i.e. without opening up any step details), we can see which of the branch paths was taken: "Update Owner to Ent AE" (shown as the bottom green line above). Remember, we renamed this step from the original random alphanumeric name - here it's making it easier to identify which step ultimately ran.

We can also expand out the Branch step (the middle green line), and this shows that each of the 3 conditions of this Automation were checked, and the Ent one was the only condition met in this case. Again, remember that we renamed these conditions, which in this case makes it clearer what each condition is for/doing, compared to if they had the original names of "Condition 1" and "Condition 2" etc.

Did this answer your question?