Hello,
I want to know if there is some way to get the SLA status from JavaScript.
Thanks to all.
*This post is locked for comments
Hello,
I want to know if there is some way to get the SLA status from JavaScript.
Thanks to all.
*This post is locked for comments
Ohh, Its a great tool and trust me, if you have want to write a web api request using javascript, there would not be an easy way other than this tool :)
Thanks Ravi, but finally i had to modify the SLA workflow to update a field into incident, and with this do the actions that i need.
I don´t know that tool, that you suggest, but i think it will be util in the future!.
Hi,
You need to write the web api request to retrieve SLA details. You can use use CRM Rest Builder to build the WEB API request. This is the easiest way to build the query as well as execute it and see the results.
carldesouza.com/dynamics-crm-rest-builder
You can download the tool here- github.com/.../releases
Hope this helps.
Hi ,
You can retrieve using web API request, download the CRMRestBuilder and prepare the query.
Here is sample retrieve multiple all SLA status -
var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/slas?$select=description,name,statecode,statuscode", 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.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var results = JSON.parse(this.response); for (var i = 0; i < results.value.length; i++) { var description = results.value[i]["description"]; var name = results.value[i]["name"]; var statecode = results.value[i]["statecode"]; var statecode_formatted = results.value[i]["statecode@OData.Community.Display.V1.FormattedValue"]; var statuscode = results.value[i]["statuscode"]; } } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send();
Sample query fro particular SLA status using SLA id -
var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/slas(e5826f37-eb11-4912-a660-50bef2482861)?$select=description,name,statecode,statuscode", 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.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var result = JSON.parse(this.response); var description = result["description"]; var name = result["name"]; var statecode = result["statecode"]; var statecode_formatted = result["statecode@OData.Community.Display.V1.FormattedValue"]; var statuscode = result["statuscode"]; } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send();
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,235 Most Valuable Professional
nmaenpaa 101,156