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:

  • "==" equal to

  • "!=" not equal to

  • "<" less than

  • "<=" less than or equal to

  • ">" greater than

  • ">=" greater than or equal to

{{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

attachment_url

Generates a contentID which can be used as attachment. A common use case for this is to embed attached images in the e-mail body.

img src="{{attachment_url 'background.png'}}" /

img src="cid: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

Syntax is case-sensitive.

Do you have some feedback for us?

If you have suggestions for improving this article,