I have created a web resource that is supposed to set a field to "required" when the form is opened. I have added the web resource to the OnLoad section of the form. However, it is not setting the field to required. (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.)
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 ideas why its not working and how I can fix it?
Thanks!
*This post is locked for comments
I have the same question (0)