The Conditional Statement action will branch between two action sets based on the result of a condition.
In the above image, the conditional statement tests to see if the Screen Active Record ID has been set.
If the Screen Active Record ID is set, then the action underneath the If...then is completed. In this case, the delete button is shown.
If the Screen Active Record ID is not set, then the action underneath the Else is completed. Here, the delete button is hidden.
As a side note, see how useful internal notes are? They are the italicized text underneath the actions. Since the action name is the same, the internal notes tells how they are configured.
To reiterate, the actions will branch and take a different path depending on the result of the condition. When one action is run, the other is ignored. The above can also be represented as such:
Furthermore, although only one action is being shown as a result of the condition, you aren't restricted to just one. You can have multiple actions within each branch.
Conditional statements will be familiar to those of you with a programming background as an "If / Else" statement.
Step 1: Add Your Conditions
Before the conditional statement can branch between either of the two actions sets, you will need to set up the condition. This will be done using the Criteria Builder.
A condition will result in one of two values: Yes or No (Or True and False).
If the condition results in Yes, then all the actions embedded within If..Then will run.
If the condition results in No, then all the actions embedded within Else will run.
When adding your first condition, you may have noticed the phrase at the top:
"If All/Any of the following are true."
This refers to when there are more than one condition. Remember, a condition will result in either Yes or No.
So, if there are multiple conditions, then all of them combined together should also result in either a single Yes or No.
The dropdown of All or Any indicates how you want to combine the conditions:
All conditions are true: Each individual condition must return Yes in order for the combination of the conditions to result in Yes.
In the above image, there are two conditions: the user has an email signature, and the user has admin permissions. Both have to be True in order to result in True. If either or both are false, then the entire condition is False.
Any of the conditions are true: At least one of the conditions must return Yes in order for the combination of the conditions to result in Yes.
In the above image, there are still two conditions. To result in True, either of the conditions can be true. It only returns False if both conditions are false.
On top of adding another condition, you have the option to ⊕ Add another group. With groups, you can bundle conditions together which need to be calculated first.
In the above image, two conditions have been grouped together: the user has a signature, and the user is an administrator. This group needs to be calculated first, before looking at the rest of the other conditions.
You can think of this as parantheses in math equations.
Step 2: Add your Actions
If you examine the above image, you will see a blue line that encloses the conditional statement. Actions are embedded within one of two sections inside the conditional statement. As a reminder:
If...then: actions embedded here will only run if the condition resolves to true.
Else: actions embedded here will only run if the condition resolves to false.
If you want your actions to be part of the conditional statement, it must be enclosed by the conditional statement. However, it is easy, for example, to accidentally drag an action outside of the Else section when you are meaning to put it inside.
In the below image, the Show / Hide Controls action (which shows the delete button) is properly within the If...then section. However, the last action is not part of the conditional statement.
There are two ways to tell the last action is not part of the else statement:
It is not indented.
It is not enclosed by the blue bracket line.
To make sure an action is part of the conditional statement and you don't wish to rely on your mouse dragging target skills, you can add an action directly within the conditional statement.
When you hover over either of the two, a plus sign appears and allows you to add an embedded action.