Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

How to open created record?

$
0
0

I have created a custom "create order" button on quote and created an action to populate details from quote to order

I triggered action using javascript

function createOrder(){
debugger;
guid = Xrm.Page.data.entity.getId();

var parameters = {};
var quote = {};
quote.quoteid = guid; //Delete if creating new record 
quote["@odata.type"] = "Microsoft.Dynamics.CRM.quote";
quote["transactioncurrencyid@odata.bind"] = "/transactioncurrencies(00000000-0000-0000-0000-000000000000)";
quote["pricelevelid@odata.bind"] = "/pricelevels(00000000-0000-0000-0000-000000000000)";
parameters.quote = quote;

var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/cr4a6_CreateOrder", false);
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 {
Xrm.Utility.alertDialog(this.statusText);
}

}
};
req.send(JSON.stringify(parameters));

}

This code is creating a new order record in the background but i need to open that from on click of that same button.

Can anyone please help me.

Thank you.


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images