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 :
Microsoft Dynamics CRM (Archived)

How To change the font color of a field using javascript

(0) ShareShare
ReportReport
Posted on by 437

Hi Folks,

I want to change the font color of a Account field of Opportunity  in ms crm using Javascript.

function SetBackgroundColor()
{
window.parent.document.getElementById("parentaccountid_lookupValue").style.backgroundColor = "Yellow"  // this one is working
window.parent.document.getElementById("parentaccountid_lookupValue").style.color = "red"; // this one is not working  I want this one to work


}

Kindly help.

Thanksc123.PNG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Michel van den Brink Profile Picture
    4,697 on at

    Hey WindyMill,

    Sorry to be the bearer of bad news but, this is what we'd refer to as Unsupported Customization - something that Microsoft and the application do not officially support and it is likely to break the form at some point (during an upgrade for example).

    I recommend that you don't use this script on your forms, to ensure compatibility with the application you should only use the Xrm client APIs to execute script on your forms.


    I'm unsure what the nature of your script is but, it seems you are trying to draw attention to the field for some reason. May I suggest this alternative, which is fully supported and future proof:

    function showNotificationOnParentAccount() 
    {
    Xrm.Page.getControl("parentaccountid").setNotification("Please look at this field!")
    }

    This script will add a notification to the field, with a tooltip that shows any custom text you need.

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans