Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

dynamic color option with content settings

(0) ShareShare
ReportReport
Posted on by 130

Hi all,

Iam currently trying to create a dynamic email template for a huge company that has different divisions. Every division has a different color for marketing emails.

I want to make it very easy for my client, so my idea is to create one email template and to use one colored devider which changes the color automatically depending on the content settings that has been chosen. As every division has an own address and contact details, we created different content settings and I already added a custom field to the content settings to add the Hex color code.

It should look like this screenshot, I have one background image and on the buttom of the picture on the left side there should be a devider in the color of the division that has been choosen in the content settings.

pastedimage1578905498080v1.png

My code is currently looking like this, but Iam not sure how to change the code that the dynamic Hex color code will be put from the content settings.
<div class="margin-bottom-25" data-section="true" style="background-image: url(&quot;mktdplp102neda.azureedge.net/.../Fn4lDAy8TfD3EWrKLkJvR0MfDTfS7YvAg8SZzNsu9uQ!&quot;); background-repeat: no-repeat; background-size: cover; background-position: center center;">
    <div style="display: block;
            width: 100%;
        ;">
      <div data-container="true" class="columnContainer" data-container-width="100" style="display: block; min-height: 70px; min-width: 20px; float: left; word-wrap: break-word; word-break: break-word; position: relative;width: 600px;flex-direction: column;">
        <div class="min-height"></div>
        <div data-editorblocktype="Divider">
          <div align="left" class="dividerWrapper">
<table class="no-spacing" style="padding: 0px; margin: 0px; width: 40%;">
  <tbody>
    <tr style="padding: 0px;">
      <td style="margin: 0px; padding: 0px 0px 0px 0px; vertical-align: top;">
      <p style="color:#25b4b0; margin: 0px auto 0px 0px; border-bottom: 20px solid; line-height: 0px; width: 100%; padding: 0px !important;"><span><!--[if gte mso 9]><br/><![endif]-->&nbsp;</span></p>
      </td>
    </tr>
  </tbody>
</table>
</div>
I already tried it in this way, but it doesn't worked. 
<tr style="padding: 0px;">
            <td style="margin: 0px; padding: 0px 0px 0px 0px; vertical-align: top;">
            <p style="color:{{msdyncrm_contentsettings.new_colorhexcode1}}; margin: 0px auto 0px 0px; border-bottom: 20px solid; line-height: 0px; width: 100%; padding: 0px !important;"><span><!--[if gte mso 9]><br/><![endif]-->&nbsp;</span></p>
            </td>
        </tr>
Does anyone have an idea to solve this?
Thank you very much in advance.
Best regards,
Daniel
  • Daniel H Profile Picture
    Daniel H 130 on at
    RE: dynamic color option with content settings

    Thank you Clofly, you helped me a lot!

    Best regards,

    Daniel

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: dynamic color option with content settings

    Hi Daniel,

    Firstly your divider should be below:

    actually  the divider height and clolr are controlled by border-bottom attribute.

    Secondly, I've attempted to make your customization work but didn't get success.

    - I tried to insert dynamic into element attribute likes:

    But CRM had ignored it after I went the marketing email live.

    - I also tried to use conditional statements:

    {{#if (eq msdyncrm_contentsettings.msdyncrm_name 'Blue content setting')}}
     

    {{/if}} Normal

    But CRM couldn't resolve expression with content settings and show me error.(Marketing email got in Error status)

    - I even tried to put dynamic expression in right side Propertie setting menu.

    So my thought is that currently we could only show field value as text on marketing email from content setting,

    there are many limitations to add more customization.

    So my workaround for you is that you could use information/data from contact's fields or contact's related entity fields as condition to show different color dividers,

    there shall be other customized fields on your contact entity to distinct people from different divisions.

    For example, I show different divider color based on contact's company(account) region.

    1. Add a custom code block and add conditional statements code

    pastedimage1578913531316v1.png

    2. Code

    {{#if (eq contact.contact_account_parentcustomerid.address1_country 'North America')}}
    

    {{else if (eq contact.contact_account_parentcustomerid.address1_country 'Europe')}}

    {{/if}}

    3. Then you can see different final result in Preview mode:

    pastedimage1578913688640v2.png

    pastedimage1578913725214v3.png

    Please read this article for how to use advanced dynamic contents(if .. else):

    https://docs.microsoft.com/en-us/dynamics365/marketing/dynamic-email-content#advanced-dynamic-content

    Regards,

    Clofly

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans