Email template dynamic fields
The following table lists dynamic fields that can be included in email templates:
| Field | Description | Example | Result |
|---|---|---|---|
| ifCond_long | Displays email content wrapped inside the pair of tags when conditions in the first tag are met. The value parameters must be integers and the available operators are:
| {{ifCond_long 2 ">" 1 }}This is shown{{/ifCond_long}} | This is shown |
| operation_long | Displays the result of a mathematical expression. The value parameters must be integers and the available operators are "+", "-", "*", and "/". | {{operation_long 2 "+" 1 }} | 3 |
| string_format | Displays a formatted string based on static text and one or more inserted variables. Variables are inserted using bracketed, numbered tokens, and the order in which they are inserted depends on the order they are listed after the string. | {{string_format "Hello [0]" SenderUserEmail}} where const SenderUserEmail is "Test user" | Hello Test user |
| m_page_url | Generates links to a portal page. The parameter can be a page name, or a page name plus an ID. | {{m_page_url "Assets"}}{{m_page_url "AssetDetail/5000"}} | Redirects to the Assets page. Redirects to the asset details page of the asset with an ID of 5000. |
| m_url | Generates absolute URLs to the Sitecore Content Hub instance. It takes a single argument, which is a relative path. | {{m_url '/img/background.png'}} | https://your.website/img/background.png |
| IsNotNullOrWhiteSpace | Displays whatever is written inside the pair of tags, if a specific variable contains a value that is not whitespace. | {{IsNotNullOrWhiteSpace TemplateVariableAsString}}This is shown{{/IsNotNullOrWhiteSpace}}where TemplateVariableAsString is "This is some text". | This is shown |
| IsNullOrWhiteSpace | Displays whatever is written inside the pair of tags, if a specific variable is either null or contains only whitespace. | {{IsNullOrWhiteSpace TemplateVariableAsString}}This is shown{{/IsNullOrWhiteSpace}} where TemplateVariableAsString is " ". | This is shown |
Important
All dynamic field syntax is case-sensitive. Ensure that field names and tags match exactly to avoid errors.
To render raw HTML in an email template, wrap the variable in triple curly braces, for example {{{variable_name}}}. If you use double braces ({{variable_name}}), the HTML tags will be escaped and shown as text instead of being rendered.
If you have suggestions for improving this article, let us know!