web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

I have the same question (0)
  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Is it possible to change the colour of a field depending on the value?

    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
    RE: Is it possible to change the colour of a field depending on the value?

    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
    RE: Is it possible to change the colour of a field depending on the value?

    Thank you Mahendar Pal  I will try this out!

  • JonClay Profile Picture
    on at
    RE: Is it possible to change the colour of a field depending on the value?

    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

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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 101

#2
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans