Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Important
This article only applies to outbound marketing, which will be removed from the product on June 30, 2025. To avoid interruptions, transition to real-time journeys before this date. More information: Transition overview
Warning
If you're using field-level security for some of your email fields, you must add the correct permissions or Customer Insights - Journeys can't process your email.
To set up field-level security:
Dynamic content gets resolved just before a message is sent to a specific individual. You'll typically use dynamic content to merge information from the recipient's contact record (such as first and last name), to place special links, and to place information and links from the content settings. If you're comfortable working in code, you can also create custom logic that includes conditional statements, for-each loops, and more. You can use dynamic content anywhere in your message body and can also use a few types of dynamic values in the message header fields (subject, from address, and from name).
Content settings are sets of standard and required values that are available for use in marketing email messages. Each includes a subscription-center link, a forward-to-a-friend link, social-media links, your postal address, and other information that can be placed into the message as dynamic values by using the personalization feature.
Dynamics 365 Customer Insights - Journeys is delivered with a single default content-settings record, which is preconfigured to use the default subscription center (also included out of the box). You can customize this record as needed, and you can also create additional records. You'll set up each customer journey to use a specific content-settings record, which means that all messages sent by that journey will use the same record. However, each journey can use a different record, which means that you can use an identical marketing-email design in two or more customer journeys, each specifying a different content-settings record. If you have more than one content-settings record, exactly one of them will be the default and will be applied automatically to each new customer journey that you create.
The values for content settings are first evaluated at send time, which means that you can edit a content-settings record at any time, and all pending and future email messages will automatically use the latest values.
Each content-settings record that you use must be available to the external marketing services, which manage email assembly and delivery. Therefore, you must publish your content-settings records by choosing Go Live whenever you create a new one.
Note
If you have other types of values that you often use in email messages, and/or that you want to manage at the customer-journey level, then you can add them as custom fields to the content-settings entity just as you can for other types of entities in Dynamics 365. However, in the current release, all custom fields for the content-settings entity must be of type text (string). More information: Customizing Customer Insights - Journeys
To view, edit, or create a content-settings record:
Go to Outbound marketing > Marketing templates > Content Settings.
A standard list page opens where you can view, sort, search, and filter the list to find a specific record and use buttons on the command bar to add or remove a record. Select a record to open it for editing or select New on the command bar to create a new one.
The Content Settings form opens. If you're editing a record that is already live, you must choose Edit in the command bar before you can edit it. If you're creating a new one, you can just start filling in the fields.
Make the following settings, as needed:
{{msdyncrm_marketingpage(3343053c-8daf-e911-a85e-000d3a3155d5).msdyncrm_full_page_url}}
{{msdyncrm_marketingpage(36458a9e-72af-e911-a859-000d3a3159df).msdyncrm_full_page_url}}
Select Save in the bottom-right corner of the window to save your settings.
If you're editing a content-settings record that was already live, then the record is republished automatically when you save it. If you're creating a new record, then select Go live on the command bar to publish it to the marketing services so you can start using it.
Personalization helps you construct valid dynamic expressions to position field values from recipient contact records, the message content settings, and other database values. This button is provided on the text formatting toolbar whenever you select a text element in the graphical designer. The button is also provided for some settings fields, such as the subject, from-address, and from-name fields.
Note
The personalization dialog only shows entities and relations that are synced with the marketing-insights service. If you need to show information or use relations for one or more entities that aren't listed, then ask your admin to add the relevant entities to the marketing-insights service. If you are an admin, then see Choose entities to sync with the marketing-insights service for instructions. The owner entity is no longer supported for email personalization. Replace it with either the systemuser or team entity, depending on which entity represents the owner of the record.
To use personalization:
Position your cursor in the field or text element where you want to insert the dynamic text, and then select the Personalization button . The personalization dialog opens.
Do one of the following:
Now you must identify the specific field you want to place. Do one of the following:
At the bottom of the dialog, you now see the final expression. Select Insert to place that expression.
Important
Lists created using for-each loops are not rendered in a particular order and are not sortable by any field.
When you're selecting a relationship in personalization, the options are displayed using one of the following naming conventions:
Where:
Note
For N:N relations, no field value is shown. That means that if you have more than one N:N relation between the same two entities, you'll see multiple identical-looking relations in the drop-down list. This situation is very rare, but if you see it, you'll have to use trial-and-error to identify the correct relation to use. To confirm, you can check the resulting expression to see if it looks like you chose the right relation (relations are shown differently here and may provide a clue), or set up a test message that includes both versions of the N:N relation and use a test customer journey to deliver it to yourself.
Here are a few examples:
Personalization creates an expression that uses a format such as the following:
{{EntityName.FieldName}}
{{EntityName(RecordID).FieldName}}
{{EntityName.RelationshipName.FieldName}}
{{EntityName(RecordID).RelationshipName.FieldName}}
Note that the notation used for relationship names in the resulting expressions doesn't match the way they're represented in the personalization dialog. Here are some examples of resulting expressions:
{{contact.firstname}}
{{msdyncrm_marketingpage(3343053c-8daf-e911-a85e-000d3a3155d5).msdyncrm_full_page_url}}
msdyncrm_full_page_url
field from the marketing page record specified by the GUID in parenthesis. You might typically use an expression of this form in a content settings record to specify a subscription center or forward-to-a-friend page.{{msdyncrm_contentsettings.msdyncrm_subscriptioncenter}}
{{msdyncrm_contentsettings.msdyncrm_forwardtoafriend}}
{{Message.ViewAsWebpageURL}}
{{msevtmgt_event(8a519395-856c-4e22-b560-650ce6d6a79d).msevtmgt_webinarurl}}
{{msdyn_survey(39128da2-c968-4627-9595-f030b6571be4).msdyn_name}}
{{contact.contact_account_parentcustomerid.name}}
{{contact.contact_account_msa_managingpartnerid.name}}
Once you have an expression that works, you can copy and paste it anywhere. You don't have to use personalization every time.
Important
You can have, at most, two hops (periods) in your field expressions. Don't try to create more complex expressions by adding more hops to the expressions produced with personalization.
Tip
If you require the types of data that are supported by personalization, then it's usually best to use the personalization feature to place the code rather than try to type it from scratch. This will ensure that the entity, relation, and field names match those used in the database and will help you avoid misspellings.
Note
Dynamics 365 Customer Insights - Journeys email sending functionality does not support calculated fields.
On the Summary tab of the Marketing Email form, you can make various non-content-related settings for your message in the Sender and receiver section. This includes values and expressions for establishing the to, from-name, from-address, and reply-to values the message will use.
One typical way to take advantage of this feature is to set the From name and From address to the owner of the contact record. Then, by assigning the owner of each contact record to the salesperson managing that contact, recipients will receive marketing emails that show a from address of somebody they may know, which can greatly increase open rates. Here's how:
{{contact.contact_systemuser_owninguser.fullname}}
.{{contact.contact_systemuser_owninguser.internalemailaddress}}
.You can use similar techniques to place the owning user's name or email address anywhere in the message content. You could do this using personalization, or copy/paste the handlebar expressions, or even type the handlebar expressions manually.
You can use a dynamic expression to define the source URL for image elements. To do so, select the image element, go to its Properties panel and then select the Personalization button next to the Source field to place dynamic text as part of the URL. You'll typically mix this with static text to assemble a complete URL. For example, you could include the recipient's contact ID or company name to select an image that is relevant for each individual recipient.
You can likewise use personalization to help construct a dynamic expression for setting a Link destination for the image.
Note
The Dynamics 365 Customer Insights - Journeys files library generates a unique GUID-based file path for each image you upload, which means that the images in the files library have unpredictable URLs that don't include your original file name. Therefore, to use the technique described here, you must host your images on your own website or any third-party hosting service where the URLs are predictable and can include a value that you can easily extract from a Dynamics 365 field.
Non-contextual field expressions (which use the form {{EntityName(RecordID).FieldName}}
) require a record ID to identify the specific record the value must come from. Usually, personalization helps you find these IDs, but sometimes you might need to find an ID manually while you're designing dynamic features for a message. To find the ID for any record:
https://<MyOrg>.crm.dynamics.com/main.aspx?appid=00001111-aaaa-2222-bbbb-3333cccc4444&pagetype=entityrecord&etn=msevtmgt_event&id=11112222-bbbb-3333-cccc-4444dddd5555
&id=
, which is followed by the ID number of your current record. Copy that number (the value only) and use it in your expression.You can add advanced logical processing to your email designs, which can make the content even more responsive to recipients, demographics, and context. This type of customization requires you to have a basic understanding of scripting and programming.
As you've seen in previous examples, dynamic content is surrounded by double braces ( {{
and }}
). This includes both standard field values that you add using the personalization feature, and the more advanced programming constructs described in this section.
Tip
If you want to display double braces in a message, rather than use them to denote the start or end of a code block, then prepend (escape) the first brace with a backslash, such as \{{
or \}}
. The slashes won't appear in your final, rendered message, but the double braces will.
Conditional (if-then-else) statements display content depending on whether one or more conditional expressions resolve to true or false. You can add the code required to create these statements by placing it within a text element, or by placing custom-code elements in between the other design elements. More information: How to enter advanced dynamic content in the designer
Conditional statements take the following form:
{{#if (<operator> <value1> <value2>)}}
Content displayed when the expression is true
{{else if (<operator> <value1> <value2>)}}
Content displayed when the first expression is false and the second one is true
.
.
.
{{else}}
Content displayed when all expressions are false
{{/if}}
Where:
{{#if … }}
.{{#if contact.is_vip}}
.{{else}}
and {{else if … }}
clauses are optional.{{/if}}
.The following table lists all the operators that you can use in your conditional expressions. Other operators aren't currently available, nor can you use complex Boolean expressions (such as with AND or OR operators) in your conditional expressions.
Dynamics 365 Customer Insights - Journeys syntax (case sensitive) | Operator |
---|---|
eq | Equal to |
ne | Not equal to |
lt | Less than |
gt | Greater than |
lte | Less than or equal to |
gte | Greater than or equal to |
For example, this conditional statement could be used to establish the language used in a message salutation based on the country of each message recipient:
<p>{{#if (eq contact.address1_country 'Denmark')}}
Hej
{{else if (eq contact.address1_country 'US')}}
Hi
{{/if}} {{contact.firstname}}!</p>
Here's an example of a conditional statement based on a Boolean (two options) field called is_vip
; note that because Boolean fields always return a value of true or false, no operator, comparison value, or parentheses are included in the condition:
<!-- {{#if contact.is_vip}} -->
<h3>Be sure to show your VIP card to receive a 20% discount!</h3>
<!-- {{/if}} -->
Tip
You can test for empty field values by using:
{{#if (eq contact.lastname '')}}
Where ''
is two single quotation marks, not a double quotation mark. This finds empty fields, but not null fields.
Tip
Though you can't use complex Boolean expressions in your conditional expressions, you can implement similar functionality as follows:
Not supported:
{{#if A and B}}<DisplayedContent>{{/if}
Is equivalent to (supported):
{{#if A}}{{#if B}}<DisplayedContent>{{/if}}{{/if}}
Not supported:
{{#if A or B}}<DisplayedContent>{{/if}
Is equivalent to (supported):
{{#if A}}<DisplayedContent>{{/if}} {{#if B}}<DisplayedContent>{{/if}}
Tip
When you are testing for values that are stored as an option set in the database, use the index values for the option set, not the display values. For example, you might have a field called contact.customertypecode
, which holds an integer to identify the type of customer it is. Each customer type code also has a display name, such that 0 = "copper", 1 = "silver", and 2 = "gold". In this case, you must set up your expression to use the index (integer), not the matching display value. Therefore, if you're looking for gold customers, you should use:
{{#if (eq contact.customertypecode 2)}}
Tip
When you are testing large numerical values, such as "1,932,333", then leave out the thousands separator (,) in the comparison statement, even though you might often see these presented in the UI. To test for this value, your expression should therefore look something like:
{{#if (eq contact.customernumber 1932333)}}
For-each loops let you step through a collection of records that are related to a specific current record—for example, to provide a list of all the recent transactions associated with a given contact. You can add the code required to create these statements by placing it within a text element, or by placing custom-code elements in between the other design elements. More information: How to enter advanced dynamic content in the designer
For-each loops take the following form:
{{#each Entity.RelationshipName }}
...
{{this.RelatedField1}}
...
{{this.RelatedField2}}
...
{{/each}}
Where:
{{#each … }}
.Entity.RelationshipName
identifies the set of related records that the loop will iterate over.{{this.RelatedField<n>}}
identifies a field name from the related record. The "this" part of this expression refers to the related record being processed in the current loop iteration, and must be followed by a valid field name for the related entity. You can include any number of fields in each loop.{{/each}}
.For example, your database could include a list of products that a contact has ordered. You could list these in an email message using code such as:
<p>You have purchased:</p>
<ul>
<!-- {{#each contact.contact_product_productid}} -->
<li>{{this.name}}</li>
<!-- {{/each}} -->
</ul>
In this example, the Dynamics 365 Customer Insights - Journeys system has been customized to include a custom entity called product, which is set up with a 1:N relationship between the contact and product entities on the productid field. For the product entity to be available to your email messages, it must also be synced with the marketing-insights service (as usual).
Important
Only the first 1,000 related items are added to the relationship for email rendering purposes. Using relationships with more than 1,000 items is not supported in email templates and might lead to unexpected results.
Also note that second level relationships are not supported. Therefore, the following syntax is not allowed:
{{#each Entity.RelationshipOnEntity}}
...
{{#each this.RelationshipOnRelatedEntity}}
...
{{/each}}
...
{{/each}}
You must be careful when entering advanced dynamic code in the designer because there are many, sometimes unexpected, ways to get it wrong, which will break your code. Here are some tips for how to enter and test your code:
and <p>
tags in your code, which can break it. Always go to the HTML tab afterwards, where you'll see all of these extra tags, and be sure to remove them.<p>
and </p>
) or within an HTML comment (for code that is entirely separate from displayed text). Don't place code outside of comments or valid HTML tag pairs (or custom-code elements), as that will confuse the editor (especially if you switch between the HTML and Design tabs). You must work on the HTML tab inspect and correct the HTML within your text elements.For example, you could set up the salutation line of an email message by entering the following onto the HTML tab of the designer (either inside or outside of a text element):
<p>{{#if (eq contact.address1_country 'Denmark')}}Hej{{else if (eq contact.address1_country 'US')}}Hi{{/if}}{{contact.firstname}}!</p>
The following example (also shown previously) shows how to use comments to enclose code that exists entirely outside of displayed content (also on the HTML tab):
<p>You have purchased:</p>
<ul>
<!-- {{#each contact.contact_product_productid}} -->
<li>{{this.name}}</li>
<!-- {{/each}} -->
</ul>
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayTraining
Learning path
Implement finance and operations apps - Training
Plan and design your project methodology to successfully implement finance and operations apps with FastTrack services, data management and more.