Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Web Resource Method does not exist

(0) ShareShare
ReportReport
Posted on by 32

I am trying to create an on change event handler js but getting the error "Web resource method does not exist".

Here is my script:

function AdvanceToStep2(executionContext) {
var formContext = executionContext.getFormContext();

var Created= "0fe096ff-262a-4480-b555-89e7751cb892";
var Step1= "0f7e76b9-fd0c-41a8-a4ef-86bd4d61535b";
var Step2= "19d9bf90-b6fd-49ca-8340-3f9b6ad8befa";


var entity = {};
entity["activestageid@odata.bind"] = "/processstages(" + Step 1+ ")";
entity["traversedpath"] = Created+ "," + Step1+ "," + Step2;

var BPFId = "2d2ed6fa-6dfd-ec11-82f6-0022481b1886";

var req = new XMLHttpRequest();
req.open("PATCH", Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.1/raf_financebpfs(" + BPFId +
")", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;

if (this.status === 204) {
alert("Success");
} else {
alert("Error");
}
}
};
req.send(JSON.stringify(entity));
}

and the error message: 

Web resource method does not exist: AdvanceToStep2
Session Id: x
Correlation Id: x
Event Name: onchange
Function Name: AdvanceToStep2
Web Resource Name: raf_AdvanceToStep2
Solution Name: Active
Publisher Name: x
Time: Mon Jul 18 2022 11:29:10 GMT+0100 (British Summer Time)

  • HK Profile Picture
    HK 32 on at
    RE: Web Resource Method does not exist

    It was a syntax error! Thankyou! 

  • Suggested answer
    kaih Profile Picture
    kaih on at
    RE: Web Resource Method does not exist

    Hello,

    There is an extra space between Step and 1:

    >entity["activestageid@odata.bind"] = "/processstages(" + Step 1+ ")";

    You can use below link to check your javascript code syntax:

    esprima.org/.../validate.html

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: Web Resource Method does not exist

    Hi,

    Check if your javascript code syntax is correct.

    esprima.org/.../validate.html

  • HK Profile Picture
    HK 32 on at
    RE: Web Resource Method does not exist

    Thanks, that makes sense.

    Well it's the only .js I have created so I am certain it is the right one. I will ensure both are published properly!

  • Guido Preite Profile Picture
    Guido Preite 54,069 Super User 2024 Season 1 on at
    RE: Web Resource Method does not exist

    in the window where you attached the event you need to choose a js file, are you sure you selected the js file where this method called AdvanceToStep2 is present? maybe you select another js file, and make sure you publish the js file and the form.

    sorry but without having access to your system that is the only thing comes to mind that can generate the error you mentioned.

  • HK Profile Picture
    HK 32 on at
    RE: Web Resource Method does not exist

    I am unfortunately new to this, how do I ensure I am connected to the correct library?

  • Guido Preite Profile Picture
    Guido Preite 54,069 Super User 2024 Season 1 on at
    RE: Web Resource Method does not exist

    the content is not relevant in this error. check if you connected the right library to the event handler and try to publish again

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans