How to build a Smart Rule
Creating tailored, scalable workflows as your team grows is essential, but can often require hours of coding to implement effective ones. The good news is that Front’s rules engine grows, adapts, and flexes with you. Rather than manually create hundreds of static workflows, use our Smart Rules to quickly create dynamic formulas that trigger actions based on your chosen dependencies. No coding or messy workflow manager is necessary, and only a few high-impact Smart Rules are needed to get the results you want.
Part 1: Start the rule
Determine whether you need to create an individual, company rule, or team rule. Individual rules will apply to private conversations in your individual inbox, team rules will apply to shared conversations in team inboxes, and company rules will apply to multiple inboxes in your different teams.
Click the gear icon on the top right of Front and into the Company or Personal settings tab, depending on which space you want to work with. In our example, we will create a team rule, within the Company tab.
Under the team name, click on Rules. Click on the blue button Add a team rule.
You will land in the Rule library and can choose one of the appropriate rule templates to start with, or click Custom rule at the top to start from scratch. For this example, we will use Custom rule.
You will see the rule builder. First, give your rule a name. Then, choose the When trigger event(s) for this rule.
We will create a rule that reads the body of an incoming message, extracts all order IDs following a specific pattern, and adds topic links pointing to the order URLs. Thus, the trigger we choose will be When inbound message is received.
Next, set the If filters for the rule that will allow the rule to narrow down the correct type of messages or actions.
Set the filter to If conversation is in Support inbox.
Part 2: Build the dynamic variable
Now we're ready to build the dynamic variable, which is what makes this rule smart. To the right side of the rule, you will see a gray box labeled Dynamic Variables. Click on the Create new button there.
You will see a panel pop up, which is the Starting point of this variable you are building. You will now be adding step-by-step the different elements that create this variable. Click Start dynamic variable path, and you will see a list of all the properties you can work with, grouped into different variable functions. To learn what each option does, see the Guide to Smart Rule variables.
We will look in the the Extract message property subsection, and choose the Body option under that section. You can also search for the option.
Once you've selected the first step of the dynamic variable, you will see the structure of the variable you are building on-screen, including the step you just added.
You will also see the Type of variable you've chosen displayed at the top, which is helpful because the subsequent steps you add will depend on the type of the previous step. If your previous step is of Type: Text, you'll see the text options in the next step; if it's of Type: Number, you'll see the number options, etc. We only show what is useful based on the type at the step you're currently building. Click Add a step to continue building the variable.
In this next step, we will be using the Extract text option.
You'll see the next step listed in your variable. Some steps will have additional dropdown options to choose from, such as this one.
For this example, we will choose All occurrences because we want to extract all order IDs in the message, and not just the first occurrence of an order ID. You will also notice that once you select this option, the Type at the top updates to Type: Text list because the result will be a list.
Continue building the newest variable step by specifying the format of the order ID the rule should look for. In the text box that says Enter text or select placeholder, click the + sign to build out the format of the order ID by stringing together the different elements of your specific order ID. For example, if your order ID is ZZ-83765-32, then the format would be as shown below.
Continue adding steps to the variable to complete the full function of the variable you need.
In our example, we will add a few more steps:
- Transform each element (map): Creates a new list with the results of the previous element
- Convert to URL: Paste in the URL format of the order management system that accesses the order IDs, and include the order ID format I created in the previous step.
Part 3: Finish the rule
Remember to add a name for this variable at the top; or one will automatically be created for you based on the elements used. Click Save. Return to the rule builder and click the Then action section. Choose the type of action compatible with your variable. Now, when you click the dropdown menu to Select variables, the new variable you created will be listed to choose from. Click Create rule to finish.
We'll name our variable Order ID URL list, and add the action Add links. From the dropdown, choose the new variable you've created.
Now, when messages or actions matching the rule occur, the rule will automatically evaluate for the dynamic variable and run the associated action.
In our example, when we receive an inbound email containing order IDs, links to the full URLs will be automatically added to the conversation in the form of topic links.
Tips & tricks
Log variables in a comment
To see a log of exactly how your Smart Rules are running, use the rule action Log variables in a comment, which will post a comment in the conversation of the results of your rule. This will help you understand if a rule is not working as intended, and also help our Support team troubleshoot with you if you reach out to us.
Accounts & Contacts custom fields
Front's Accounts and Contacts has a custom fields feature in which you can add your own fields to the account or contact. The default rule engine, even without Smart Rules, already has these custom fields conditions built-in. Smart Rules also has these custom fields options in the dynamic variable. When building a rule that requires custom fields, first try creating with the default rule engine without using dynamic variables; if it does not work as intended, then move to Smart Rules.
Advanced: chaining variables
A dynamic variable can reference a previous dynamic variable you built in the rule, useful for advanced use cases. When chaining variables, you can only reference variables created before the variable you're currently editing, and you cannot reorder the variables.
For instance, you might want to assign an inbound message to the recipient and add a comment starting with "Hi [name of recipient]." You start by creating a variable Main recipient referring to the teammate in the To field of the email, and use it for the assign action. Rather than starting from scratch for the second variable, Name of main recipient, you can start by reusing the result of the previous variable.
- Smart Rules: Get an introductory orientation on Smart Rules and the related resources.
- Smart Rules use cases: Gain inspiration from common ways to leverage Smart Rules to supercharge your workflows.
- Understanding Smart Rule variables: Get the breakdown on how exactly the dynamic variables, which are what enable the rule to be smart, work.
- Guide to Smart Rule variables: Check out the glossary of all the different steps and options you can have in the dynamic variable of a Smart Rule.
This feature is available on the Enterprise plan.