🎯 Templates Audience Targeting
A targeting rule could be applied to each template to define who can use it, based on the user profile data.
Intrinsically, targeting rules are a combination of values and expressions that are evaluated against a user profile to determine if a template is shown to him or not.
N.B: This option is disabled by default.
Targeting rules can use user profile information through the following tags:
| ||User full name. (for example "Bob Dirac")|
| ||User UPN. In Active Directory, a User Principal Name (UPN) is the name of a system user in an email address format. A UPN (for example: "email@example.com") consists of the user name (logon name), separator (the @ symbol), and domain name (UPN suffix). |
Important: A UPN is not the same as an email address. Sometimes, a UPN can match a user's email address, but this is not a general rule.
| ||User email (for example: "firstname.lastname@example.org")|
| ||User preferred language in Microsoft 365. |
Language and locale codes are limited to those in the ISO 639-1 standard.
| ||User given name (for example: "Bob")|
| ||User country (for example: "France")|
| ||User company name (for example: "Contoso")|
| ||User department (for example: "Marketing")|
| ||User city (for example: "Paris")|
| ||User job title (for example: "Product Manager")|
| ||User surname (for example: "Dirac")|
| ||* Office 365 usage location. (for example: "US")* |
Rely on the ISO 3166-1 alpha-2 country codes...
Be careful: These tags are CASE-SENSITIVE!
N.B: The template will be shown to a user if the expression is evaluated as
This section shows some common scenarios to target your templates to specific audiences in an organization.
Examples: Boolean operators
"Users from France"
user.msCountry === 'FR'
"Users outside Germany"
user.msCountry !== 'DE'
"English speakers from any country"
Examples: Combining multiple criteria
"French or Belgium users from the Marketing Department"
( user.msCountry === 'FR' || user.msCountry === 'BE' ) && user.msDepartment === 'Marketing'
Domain-based targeting: "users with @contoso.com or @contoso.fr in their domain name"
user.msEmail.includes('@contoso.com') === true || user.msEmail.includes('@contoso.fr') === true
A "Check Syntax" button is available to test the rule against the current logged user. You can expect 3 kind of outcomes.
- You would have access:
- You would not have access:
- An error is detected:
In case of error, the technical details are also available, helping you solve the issue.
Enable your rule
You just have to save your template.
Due to our caching mechanism, an update to the user profile may not be reflected immediately and therefore the targeting rule may not be applied for a few time.
See our Known Issue file for more information.