I am trying to make the Manufacturer field on an Opportunity form become required when a user opens the form. (I cannot simply use a business rule to do this because the Manufacturer field will then become required in QuoteWerks as well, which is where many of our Opportunity records are created.)
I have created a javascript web resource and added to the OnLoad section of the form, but receive the following error when I open the form: "Web Resource Method Does Not Exist: Set Manufacturer To Required."
Below is my code:
function SetManufacturerToRequired() {
var value = Xrm.Page.getAttribute("new_opportunityscope");
if (value != null) {
if (value == "Product") {
Xrm.Page.getAttribute("new_manufacturer").setRequiredLevel("required");
} else {
Xrm.Page.getAttribute("new_manufacturer").setRequiredLevel("none");
}
}
else {
Xrm.Page.getAttribute("new_manufacturer").setRequiredLevel("none");
}
}
Any help debugging this would be greatly appreciated. Thanks!