If tokens declare to only include a section of content if an expression evaluates to true. Each If token must have a corresponding endif token to close of content covered by the if. That is the content between the starting if and ending endif token is that which is conditionally included by the token expression. If tokens may also be nested each with their own endif token
Expressions in the if token can be composed with multiple logical operators and group brackets
Example if tokens are shown below. In all example tokens the template is sourced from a Case (incident)
Include if Boolean column true
[if isescalated]
<p>
Your case has been escalated [productid
</p>
[endif]
The paragraph is only included if the field Escalated as set to true. Any column of a boolean type has this behaviour where no operator is used
Include if column populated
[if productid]
<p>
Thank you for your enquiry about [productid]
</p>
[endif]
The paragraph is only included if a Product has been populated in the case. This expression is for a non-boolean type so resolves to true if the value is not null. Any column of a non-boolean type has this behaviour where no operator is used
Include if column not populated
[if productid null]
<p>
The product is not identified for this case
</p>
[endif]
The paragraph is only included if a Product has not been populated in the case. Note not null is also a valid operator and equivalent to the shorter token operator above
Include if column equal to value
[if prioritycode equals 1]
<p>
This case is high priority
</p>
[endif]
Displays the paragraph if Case Priority is High. In this case option value for high is 1, but other column and value types may also be used and will be parsed according to their type
Include if column equal to value
[if prioritycode not equals 1]
<p>
This case is not high priority
</p>
[endif]
Displays the paragraph if Case Priority is not High. In this case option value for high is 1, but other column and value types may also be used and will be parsed according to their type
Include if column equal to another column
[if customerid equals primarycontactid]
<p>
The primary contact is set as the customer
</p>
[endif]
Displays paragraph if the Primary Contact on the Case is the same as the selected Customer
Include if column not equal to another column
[if customerid not equals primarycontactid]
<p>
The primary contact is not set as the customer
</p>
[endif]
Displays paragraph if the Primary Contact on the Case is not the same as the selected Customer
Include if column linked through polymorphic lookup is populated
[if customerid|contact.emailaddress1]
<p>
The primary contact is not set as the customer
</p>
[endif]
Displays the paragraph if the Customer is a Contact with Email Address populated. This expression demonstrates that columns in records linked through a lookup may be used in expressions. The format for linked columns in the expression is the same as that used in field tokens
Include if either of 2 conditions is met (OR logical operator on conditions)
[if customerid|contact.emailaddress1 or customerid|primarycontactid.emailaddress1]
<p>
There is a linked contact with an email address
</p>
[endif]
Displays if the Customer is a Contact with Email Address populated, or there is a Primary Contact set who contains an email address. This example demonstrates joining conditions with an or operator
Include if either of 2 conditions with bracket groups is met (both AND & OR logical operators)
[if customerid|contact.emailaddress1 or ( customerid|account.accountid and primarycontactid.emailaddress1)]
<p>
There is a linked contact with an email address
</p>
[endif]
Displays paragraph if the Customer is a Contact with Email Address populated, or the customer is an account and there is a Primary Contact set who contains an email address. This example demonstrates joining multiple conditions and grouping with brackets
Nested Ifs
[if prioritycode equals 1]
<p>
This case is high priority[if ownerid|systemuser.systemuserid] and has been assigned to [ownerid|systemuser.firstname][endif]
</p>
[endif]
Nested token extends the sentence if the owner of the case is a user (rather than a team). This example demonstrates the ability to nest tokens