Hi, I'm trying to Revise Quote through Web Api request but I'm always getting error like this,
When I search for error code it is mentioned as Invalid Argument
<crmerror>
<ErrorId>80040203</ErrorId>
<ManagedErrorName>InvalidArgument</ManagedErrorName>
<ErrorMessage>Invalid argument.</ErrorMessage>
<UnManagedErrorName>IDS_INVALIDARG</UnManagedErrorName>
</crmerror>
My code:
var parameters = {};
parameters.QuoteId = "CBE9F1D4-C91F-E911-A81F-000D3A31270E";
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/ReviseQuote", 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 === 200) {
var results = JSON.parse(this.response);
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(parameters));
I don't know what I'm missing here. Can anyone please help me out ?
Regards,
Praveen
*This post is locked for comments
Could you try including the ColumnSet in your parameters as the system first tries to do a Close Quote and it might be failing because of missing ColumnSet parameter.
var parameters = {};
parameters.QuoteId = "CBE9F1D4-C91F-E911-A81F-000D3A31270E";
parameters.ColumnSet = {AllColumns: true, Columns: []};
Hope this helps.
Hi,
Instead of sending the parameters in request.send() send the GUID in the URL itself.
var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/ReviseQuote(CBE9F1D4-C91F-E911-A81F-000D3A31270E)", 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 === 200) { var results = JSON.parse(this.response); } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send();
Thanks,
Srikanta
If found useful, please mark the answer as verified
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6