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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Is it possible to change the colour of a field depending on the value?

(0) ShareShare
ReportReport
Posted on by

Hello everyone

We have a field in our database called Deceased which has values of either Yes or No as shown below:

pastedimage1663227763659v1.png

As you can see, the field is shown as black text on a white background. What I'd like to achieve is to change the value to show as white text on a red background if the value is Yes and remain as black text on a white background if the value is No.

When I click on the Edit box for the field in Customizations, I am able to change the hex colour value, but it doesn't seem to change anything on the form.

Any help would be much appreciated!

Many thanks
Jon

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    There is not supported way of changing field color, only unsupported options refer

    community.dynamics.com/.../need-change-the-colour-of-text-field-value-in-dynamics-365

  • MuhammadAnas Profile Picture
    15 on at

    To Change the field, background-color web resource and using this code. Inspect the id to get field id and select id

    if(document.getElementById("Select id of Field").value === "0")

    {

    document.getElementById("Your Field ID").style. background='yellow';

    }

    else{

    document.getElementById("Your Field ID").style. background='red';

    }

  • JonClay Profile Picture
    on at

    Thank you Mahendar Pal  I will try this out!

  • JonClay Profile Picture
    on at

    Thank you so much, I will take a look at doing this :)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 39 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 37 Super User 2026 Season 2

#3
Subra Profile Picture

Subra 24 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans