# Audience Targeting


# Purpose

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 or not.


N.B: This option is disabled by default.

# Available values

Targeting rules can use user profile information through the following tags:

Tag Description
user.displayName User full name. (for example "Bob Dirac")
user.userPrincipalName 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 protected]") 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.mail User email (for example: "[email protected]")
user.preferredLanguage User preferred language in Microsoft 365.
Language and locale codes are limited to those in the ISO 639-1 standard.
user.givenName User given name (for example: "Bob")
user.country User country (for example: "France")
user.companyName User company name (for example: "Contoso")
user.department User department (for example: "Marketing")
user.city User city (for example: "Paris")
user.jobTitle User job title (for example: "Product Manager")
user.surname User surname (for example: "Dirac")
user.usageLocation * Office 365 usage location. (for example: "US")*
Rely on the ISO 3166-1 alpha-2 country codes...


Be careful: These tags are CASE-SENSITIVE!

# Common scenarios

In combination with tags, targeting rules can use standard javascript operators and functions.


N.B: The Business Solution will be shown to a user if the expression is evaluated as true

This section shows some common scenarios to target your templates to specific audiences in an organization.

# Examples: Boolean operators

# "Users from France"

user.country === 'FR'

# "Users outside Germany"

user.country !== 'DE'

# Examples: Javascript functions

# "English speakers from any country"


# Examples: Combining multiple criteria

# "French or Belgium users from the Marketing Department"

( user.country === 'FR' || user.country === 'BE' ) && user.department === 'Marketing'

# Domain-based targeting: "users with @contoso.com or @contoso.fr in their domain name"

user.mail.includes('@contoso.com') === true || user.mail.includes('@contoso.fr') === true

# Tips

Operator precedence

Rules follows the standard javascript Operator Precedence so you can combine multiple rules in one expression,

Syntax Assistant

A "Check Syntax" button is available to test the rule against the current logged user. You can expect 3 kind of outcomes.

  1. You would have access
  2. You would not have access
  3. 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.

Known Issue

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.