Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Need help debugging javascript Web Resource code — getting error message “Web Resource Method Does Not Exist”

Posted on by Microsoft Employee

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!

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans