web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

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

(1) ShareShare
ReportReport
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?
I have the same question (0)
  • Maarten van Gent Profile Picture
    5 on at

    Same problem here. Driving me nuts haha.

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

  • Suggested answer
    Aga M Profile Picture
    on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans