Hi, I am trying to call an action through web api, but it keeps giving me this error "Resource not found for the segment 'invoice'". It is an action associated with invoice entity, here is the javascript, did I miss anything?
function executeCompleteInvoice(){ debugger; var organizationUrl = Xrm.Page.context.getClientUrl(); var id = Xrm.Page.data.entity.getId().replace('{', '').replace('}', ''); var query = "invoice("+id+")/Microsoft.Dynamics.CRM.actiontestinvoice123"; var req = new XMLHttpRequest(); req.open("POST", organizationUrl + "/api/data/v8.0/" + query, true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4) { req.onreadystatechange = null; if (this.status == 200) { alert("Action called successfully"); } else { var error = JSON.parse(this.response).error; alert(error.message); } } }; req.send(); }
*This post is locked for comments
That means that you're doing something wrong. Please provide your full code and screenshot of action.
Thanks Andrew, but I still got error "request message has unresolved parameter", and I didn't send parameter
Have you tried to use invoices instead of invoice?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156