Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Suggested answer

Change field color

Posted on by 85

Hi guys,

I want to change the color of the field in the invoice when it has data. for example, it converts to red. what code should I use for it?

Thanks you

  • Suggested answer
    Mustajab Profile Picture
    Mustajab 40 on at
    RE: Change field color

    Hi Amin,

    Yes, it can be definitely done as we can see in our earlier comments. But it has a down that is performance. As with a lot of legacies JS commands getting depreciated (Article) I feel it is not right to build our client-side validations using such commands. 

    Alternatively, I would suggest using the formcontext.ui.setformNotification (article). You can use the info in which you can required text that invoice has amount. The benefit of it is that is supported on the Unified interface (UI) as well.

    Thanks,


    Mustajab

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: Change field color

    Hi Amin,

    You can do it using unsupported way in JavaScript

    Please refer below code for more details:

    balugajjala.wordpress.com/.../

  • Suggested answer
    CRMJetty Profile Picture
    CRMJetty 3,508 on at
    RE: Change field color

    Hello,

    You can refer this,

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/201427/change-a-color-of-text-field-value/670102

    Or,You can try this code,

    window.parent.document.getElementById("field_c").style.backgroundColor = "red";

    I hope it helps,

    Thanks.

    Please mark as verified if the answer is helpful. Welcome to join hot discussions 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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans