How to close Incident using WebApi
Views (4218)
Following JavaScript code can be used to Resolve Incident using JavaScript and WebApi:
var incidentresolution = {
"subject": "Put Your Resolve Subject Here",
"incidentid@odata.bind": "/incidents(0A9F62A8-90DF-E311-9565-A45D36FC5FE1)",//Replace this Id with Id of case you want to resolve
"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));
Запись How to close Incident using WebApi впервые появилась CRM Mentor.
This was originally posted here.

Like
Report
*This post is locked for comments