Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How to Update Case status to resolved using WEB API

Posted on by 195

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.

  • Verified answer
    Marco.P Profile Picture
    Marco.P 2,405 on at
    RE: How to Update Case status to resolved using WEB API

    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));

  • Vijay patil Profile Picture
    Vijay patil 195 on at
    RE: How to Update Case status to resolved using WEB API

    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));

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans