Hi all,
How to Update Case status to resolved using WEB API, I am looking for WEB API to update case status to resolved. Please update me on same.
Hi all,
How to Update Case status to resolved using WEB API, I am looking for WEB API to update case status to resolved. Please update me on same.
Try with this:
var parameters = {};
var incidentresolution = {};
incidentresolution.activityid = "00000000-0000-0000-0000-000000000000"; //place your incident id
incidentresolution["@odata.type"] = "Microsoft.Dynamics.CRM.incidentresolution";
parameters.IncidentResolution = incidentresolution;
parameters.Status = 1; //your status as integer
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/CloseIncident", 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) {
//Success - No Return Data - Do Something
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(parameters));
i have already used below script and working fine but now i want to update different status under resolve
var incidentresolution = {
"subject": "Put Your Resolve Subject Here",
"incidentid@odata.bind": "/incidents(0A9F62A8-90DF-E311-9565-A45D36FC5FE1)",//Id of incident
"timespent": 60,//This is billable time in minutes
"description": "Additional Description Here"
};
var parameters = {
"IncidentResolution": incidentresolution,
"Status": -1
};
var context;
if (typeof GetGlobalContext === "function") {
context = GetGlobalContext();
} else {
context = Xrm.Page.context;
}
var req = new XMLHttpRequest();
req.open("POST", context.getClientUrl() + "/api/data/v8.2/CloseIncident", 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 === 204) {
//Success - No Return Data - Do Something
} else {
var errorText = this.responseText;
//Error and errorText variable contains an error - do something with it
}
}
};
req.send(JSON.stringify(parameters));
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,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156