Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Adding a color or background-color via property-reference in an email not working

Posted on by 105

I am trying to follow the documentation here:
https://docs.microsoft.com/en-us/dynamics365/marketing/custom-template-attributes#add-property-reference-attributes-to-implement-style-settings-in-the-body

I added this code to the head of my email:

  <meta type="xrm/designer/setting" name="accent" value="#00b9be" datatype="color" label="Accent">

And I created a content block with a button. In order to  achieve that the button takes on the accent color defined in the template, I added property-reference="background-color:@accent;"
to the a tag. But it is not working. 


<div align="center" style="margin: 0px;" class="buttonWrapper" data-sub-block="true" data-block-datatype="Button" property-reference="background-color:@accent;"><a class="buttonClass" href="#Button" style="text-align: center; margin-right: auto; margin-left: auto; display: inline-block; border-radius: 2px; color: rgb(255, 255, 255); width: fit-content; height: auto; padding: 10px 20px; max-width: 100%; border-color: rgb(255, 255, 255); border-width: 1px; border-style: none; vertical-align: middle; box-sizing: border-box; line-height: normal; font-size: 13px;mso-hide: none !important;" data-msdyn-tracking-id="cde18197abc9716480265204sdf83" property-reference="background-color:@accent;">
    <span property-reference="@font-family" style="color: rgb(255, 255, 255); text-decoration: none; font-size: 13px; font-family: &quot;Open Sans&quot;, Arial, Helvetica, sans-serif;">Learn more of whatever you want</span>
    </a></div>
I also tried this with a p tag with no effect:
<p property-reference="color:@accent;">
What am I doing wrong?
  • Suggested answer
    Aga M Profile Picture
    Aga M on at
    RE: Adding a color or background-color via property-reference in an email not working

    Hi

    As per documentation, the property-reference functionality is for adding element attributes, not CSS styles. It can be used for controlling image src attribute, align, width, height, etc.
    Invalid attributes that do not belong to an element as per HTML specification are automatically removed. "color" attribute is invalid for "p" element, so it is removed. Same for background-color.

    Dynamic styling using custom properties can be achieved by using specific comments referencing custom property values, as described here: Use custom attributes to enable designer features in templates (Dynamics 365 Marketing) | Microsoft Docs

    Best Regards,
    PM, D365 Marketing

  • RE: Adding a color or background-color via property-reference in an email not working

    Same problem here. Driving me nuts haha.

    The weird thing is that at one point it looked like it did work?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans