Skip to main content

Notifications

Microsoft Dynamics CRM forum
Suggested answer

Web resource method does not exist

Posted on by 62

I have written Dynamics CRM JScript code to populate fields based on previous input, but while running the script I am getting error as "Web resource method does not exist".

**My code: -**

var B_line = window.B_line || {};
(function() {

this.formOnLoad = function(executionContext) {
const formContext = executionContext.getFormContext();
const businessarea = formContext.getAttribute("new_buniessarea21").getText();
const businessline = formContext.getControl("new_businessline21");
function Options() {
businessline.clearOptions();
for (var i = 0; i < arr.length; i++) {
businessline.addOption({
value: arr[i].value,
text: arr[i].text
});
}
}
```
}).call(B_line)

I using this command B_line.formOnLoad to call the function OnChange of the event.

Showing error as "Web resource method does not exist"

Can anyone help me out?

Error image

pastedimage1672396958193v1.png

  • Deepan Raj Profile Picture
    Deepan Raj 25 on at
    RE: Web resource method does not exist

    Hi 

    Please use this code that i modified 

    function var B_line(executionContext) {
    debugger;

    const formContext = executionContext.getFormContext();
    const businessarea = formContext.getAttribute("new_buniessarea21").getText();
    const businessline = formContext.getControl("new_businessline21");
    function Options() {
    businessline.clearOptions();
    for (var i = 0; i < arr.length; i++) {
    businessline.addOption({
    value: arr[i].value,
    text: arr[i].text
    });
    }
    }
    }

    -->Main issue is you didn't close the function 

    call the function name as var B_line in form onload step in form properties 

    Please Rply if you find this useful

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,962 Moderator on at
    RE: Web resource method does not exist

    Hi,

    Please check syntax issue on below tool

    esprima.org/.../validate.html

  • Suggested answer
    Ganesh Chowhan Profile Picture
    Ganesh Chowhan 160 on at
    RE: Web resource method does not exist

    Hi there,

    I believe there is something need to re-check around script namespace declarations.

    Following code works perfectly. Please try this.

    if (typeof (B_line) === "undefined")

    { B_line = {}; }

    B_line.formOnLoad = function(executionContext) {

    const formContext = executionContext.getFormContext();

    Xrm.Utility.alertDialog("testing script success")

    }

    Also I see in your scrip there is arr.length n loop, where are you getting the arr variable?

    If any other issues try to debug in browser pressing F12 and adding debugger; at the beginning of the code. 

  • Rajath Krishna S Profile Picture
    Rajath Krishna S 62 on at
    RE: Web resource method does not exist

    I have entered it correctly

    Pls check

    pastedimage1672400475237v1.png

  • Suggested answer
    RE: Web resource method does not exist

    Hi Rajath,

        Please check your event, library and function name is entered correctly in handler properties

    pastedimage1672399800422v1.png

    If you found this helpful, like or verify my answer

Under review

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

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans