In Triggre, rules are used in many places, from filtering the data you want to show in a table, looking up data to decisions. In this article, we show you how to make a rule for a decision. The same principles apply to all places you can use rules however.
The most important thing to know about rules, is that they can have different outcomes. When filtering data on a page, the rule has to be a true/false rule, meaning that the outcome for is either true, or false. All records of your data item for which the rule is true, are included, the ones for which the rule is false, are left out.
But there are more options. For a decision you can use a true/false rule too, but also a rule based on a pick list, a text, a date, time span and even a number. When you use a pick list as a rule in a decision, you can choose a path for each value of the pick list for example. And for numbers you can use specific numbers and ranges of numbers in paths.
How to use the rule editor
For now, let’s look at an example of how to make a true/false rule for a decision. We will make a rule, in a decision in a user flow, that indicates whether the current user has the email address email@example.com or firstname.lastname@example.org:
Add a decision to the user flow. You will now see the rule editor, indicating you should make a rule to base the decision on:
The rule editor is already in add mode as you can see by the blue add button in the lower left corner.
Click the green add button to add a step to the rule, which will show what you can add:
As you can see, we only have the option to add a property from the user flow. If there are more options, they are shown here.
Select property from user flow, then expand Current user and select Email:
This will add a value to your rule:
When the value is selected, Triggre will show you the entire name and two add buttons to add a step before or after. When you deselect a step, the short name is shown only, in this case simply Email.
Click the right add button to add a step after the Email. Note how Triggre always shows you only those options that are possible for you to add. In this case, we can choose a sign to add:
We choose Comparison sign and then we choose Equals:
Our rule is now updated with a comparison sign after the email:
Notice how the Email andadd button are both surrounded by a gray marker. This indicates the left-hand side, and right-hand side of the equation. We click the green add button to add a Specific value:
Because Email is a text, Triggre will now ask you to enter a text as the specific value. We type email@example.com:
When we have added the specific value, our rule now looks like this:
To add another email address to be checked, we have to add an OR statement. We start by selecting the Equals sign:
Notice how again the left and right hand side of the equation are gray. When we now click the right add button, we can add an AND or OR statement:
We choose OR and now our rule looks like this:
Note how the OR also has the left-hand side and right hand side gray, but they are different than for the equals sign. This is very important to remember, because Triggre will automatically place brackets depending on which item in your rule you have selected.
Now repeat steps 2 – 5, using firstname.lastname@example.org as the specific email address. The rule will now look like this:
The rule is now finished. Click the blue add button to leave add mode in the rule editor, and finish the wizard.
Tip: Should you ever encounter a situation where Triggre places the brackets in a location you didn’t expect, it’s likely you can solve that by simply selecting another item of the rule and trying again.