Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

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

Posted on by 202

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

  • JonClay Profile Picture
    JonClay 202 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 :)

  • JonClay Profile Picture
    JonClay 202 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!

  • MuhammadAnas Profile Picture
    MuhammadAnas 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';

    }

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 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

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

Product updates

Dynamics 365 release plans