Hello Experts,
I have a requirement that, on creation of a case record i should trigger a javascript which updates the case fields through Action.
My JavaScript code is mentioned below.
function callaction()
{
debugger;
var Id = Xrm.Page.data.entity.getId().replace('{', '').replace('}', '');
var parameters = {};
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.0/incidents("+ Id +")/Microsoft.Dynamics.CRM.new_Update_Case_Acc_details", 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 data = JSON.parse(this.response);
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(parameters));
}
*This post is locked for comments
I have the same question (0)