I'm working with web resources in the Account form, these are the specific things that I'm using:
Entity: Account
Web Resource: JavaScript
Event: OnLoad
Im trying to change the background color of a field based on the text that has, for example:
Text of the textBox: Red
Background color will be 'painted' to Red
The problem is that im getting this error when I try to open an account:

This is my code in javascript:
function ChangeColor(){
if (Xrm.Page.GetAttribute("em_Color").GetValue() === "Green")
document.getElementById("em_Color").style.backgroundColor = 'green';
else
if (Xrm.Page.GetAttribute("em_Color").GetValue() === "Red")
document.getElementById("em_Color").style.backgroundColor = 'red';
else
document.getElementById("em_Color").style.backgroundColor = 'yellow';
}
I added the Javascript library to the form, and then selected the function and event in wich should be fired.
Does anyone know what I'm doing wrong?
Thanks for your help!
*This post is locked for comments
I have the same question (0)