I am trying to make the Manufacturer field on a CRM 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!
SetManufacturerToRequired
added correctly when you add it OnLoad Error says that you have attached to onLoad Event but in Webresource it could not find. You probably have added Function name in CRM OnLoad asSet Manufacturer To Required
If possible could you please post screenshot of your Edit (Form) and where you add onLoad Event will give more info. – AnkUser