Hi, I'm a Javascript newbie, and am trying to do a simple script in CRM 2011. I can't stop getting the ever-useful "object expected" error, so am hoping someone can tell me what I'm doing wrong here?
The function is below, triggers on the onChange event of the customertypecode field.
function GPAcc() {
var val1 = Xrm.Page.getAttribute("customertypecode").getSelectedOption().text;
if(val1 == "Customer") {
Xrm.Page.getAttribute("accountnumber").setRequiredLevel("required");
} Else {
Xrm.Page.getAttribute("accountnumber").setRequiredLevel("none");
}
}