Personalization syntax personalization-syntax

Expressions in the Journey Optimizer B2B Edition personalization editor are based on the Handlebars templating syntax. It uses a template and an input object to generate HTML or other text formats. Handlebars templates look like regular text with embedded Handlebars expressions.

For more details about the Handlebars and how it works, refer to the HandlebarsJS documentation.

General rules

Simple expression example:

{{account.accountName}}

Where:

  • account is a namespace.

  • accountName is a token composed by attributes.

    note note
    NOTE
    The attributes structure is defined in an Adobe Experience Platform XDM Schema.
  • Identifiers can be any Unicode character except for the following:

    code language-none
    Whitespace ! " # % & ' ( ) * + , . / ; < = > @ [ \ ] ^ ` { | } ~
    
  • The syntax is case sensitive.

  • The words true, false, null and undefined are only allowed in the first part of a path expression.

  • In Handlebars, the values returned by the {{expression}} are HTML-escaped. If the expression contains &, the returned HTML-escaped output is generated as &amp;. If you do not want Handlebars to escape a value, use the +triple-stash_.

  • For literal functions arguments, the templating language parser does not support single unescaped backslash (\) symbol. This character must be escaped with an additional backslash (\) symbol. For example :

    code language-none
    {%= regexGroup("abc@xyz.com","@(\\w+)", 1)%}
    

Helpers helpers-all

A Handlebars helper function is a simple identifier that can be appended with parameters. Each parameter is a Handlebars expression. These helpers can be accessed from any context in an email template.


{{#each account.accountOrganization.annualRevenue.amount}}
    <li>{{this.name}}</li>
{{/each }}

For more detailed information about these functions, see Helper functions.

Literal types literal-types

Adobe Journey Optimizer B2B Edition supports the following literal types:

Literal
Definition
String
A data type comprised of characters surrounded by double quotes.
Examples: "prospect", "jobs", "articles"
Boolean
A data type that is either true or false.
Integer
A data type representing a whole number. It can be positive, negative, or zero.
Examples: -201, 0, 412
Array
A data type that is comprised as a group of other literal values. It uses square brackets to group and commas to delimit between different values.
Note: You cannot directly access the properties of items within an array.
Examples: [1, 4, 7], ["US", "FR"]
CAUTION
The use of xEvent variable is not available in personalization expressions. Any reference to xEvent results in validation failures.
recommendation-more-help
6ef00091-a233-4243-8773-0da8461f7ef0