
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.
Thanks
*This post is locked for comments
I have the same question (0)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.