Currently only available on Google domains.
Introduction to Conditional Formatting
Using variables (such as Job Title - $orgJobTitle) is a great way to make sure that each of your user's email signatures includes all their unique information without needing to create totally bespoke signatures for each person.
But, what happens if the the user doesn't have any information in their profile for one of the variables in their signature? Well, the information won't be populated and the space on the signature will appear blank (which is far from ideal). This is where Conditional Formatting comes in.
Conditional Formatting allows you to specify the conditions that must be met in order for the variable to be displayed, and a hierarchy of other variables to use if the first variable cannot be displayed (due to the profile field being blank). For example, if a user doesn't have a Business Mobile, you can format the signature so that it shows the Company Telephone number instead.
Understanding the syntax
Let's have a quick look at an example format (which states that if the Primary Mail field on the user's profile is not blank, the value for the Primary Mail should be displayed where the variable is on the next line):
#if ($mailPrimary != "")Email: $mailPrimary#end
In the example above, you can see that there are elements that start with a # (e.g. #if, #end). These are the Actions - they state what the sentence should do. See the table below for the list of Actions and a description.
Action | Description |
#if |
This is used to check is a statement if true or false. If the statement is true, the proceeding value will be displayed. if the statement is false, nothing will be displayed, unless it's followed by an #else statement |
#elseif | Multiple statements can be chained together using #elseif. This is used in place of #if for any additional values that need to be checked after the initial #if statement. |
#else | This is used to determine what value will be displayed if the #if or #elseif statement is false. |
#end | This must be used to delineate the end of a single statement or chain of statements. |
You should also see that there is an element that adds a Condition to the value (in the example, this is the != after the variable). These Conditions are used to create the statement that must return True or False, and in turn decide whether the variable is displayed or not. See the table below for a list of Conditions and their description.
Condition | Description |
== | Value is equal to. |
!= | Value is not equal to. |
> | Value is greater than. |
< | Value is less than. |
>= | Value is greater than or equal to. |
<= | Value is less than or equal to. |
Examples
If a user's department is equal (==) to Sales, display the user's Business Mobile ($phoneBusinessMobile)
#if ($orgDepartment == "Sales")
Mobile Number: $phoneBusinessMobile
#end
If a user's department is not equal (!=) to Sales, display the Business Phone Number ($phoneBusiness)
#if ($orgDepartment != "Sales")
Mobile Number: $phoneBusiness
#end
If a user's department is equal (==) to Sales, display the user's Business Mobile ($phoneBusinessMobile), but if it is not equal (!=) to Sales, display the Business Phone Number ($phoneBusiness). Then, if the Business Phone Number is blank, the Company Phone Number will be displayed instead.
#if ($orgDepartment == "Sales") Mobile Number : $phoneBusinessMobile #elseif ($orgDepartment != "Sales") Tel: $phoneBusiness #else ($phoneBusiness == " ") Tel: $phoneCompany #end
If a user is a member of group.one@example.com, display the text "I'm part of Group.One"
#if (${profile.groups.contains("Group.one@example.com")})
I am part of Group.One
#end
Multiple Conditional Statements
If you have multiple conditional statements in the same signature (e.g. multiple #if statements), ensure that you place #end after each statement to separate them.
#if($!pronouns) Pronouns $pronouns #end
#if($!workingHours) Working Hours $workingHours #end
Suppressed Variables
If you use a variable in the signature with an exclamation mark (e.g. $!personalNickname), if the variable field is not empty / null, it will display the variables value (e.g. display the nickname). If the field is empty / null, it will display nothing at all.
Troubleshooting
When using #if statements in signatures, sometimes the WYSIWIG editor doesn’t add a line break to the HTML code. This means when there is no value matching the #if statement, it leaves a blank line in the generated signature.
To fix this:
Add a line break <br /> in the HTML right before $orgjobtitle:
Before:
#if($orgJobTitle != "")</span><span style="font-family: tahoma, arial, helvetica, sans-serif;">$orgJobTitle#end
After:
#if($orgJobTitle != "")</span><span style="font-family: tahoma, arial, helvetica, sans-serif;"><br />$orgJobTitle#end