web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Revise Quote Web Api request not working

(0) ShareShare
ReportReport
Posted on by 25

Hi, I'm trying to Revise Quote through Web Api request but I'm always getting error like this,

ReviseQuoteError.png

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

  • Suggested answer
    Srikanta Mahapatro Profile Picture
    190 on at

    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

  • Verified answer
    Kokulan Profile Picture
    18,054 on at

    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.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans