Resolve and Cancel Cases in CRM/Dynamics 365 CE using C#

Hi,

I was working on Service Module and had to develop a tool which can Resolve and Cancel cases.

Here is the C# code for the same.

To Resolve the Cases

        Entity IncidentResolution = new Entity(“incidentresolution”);
        IncidentResolution.Attributes[“subject”] = “Subject Closed”;
        IncidentResolution.Attributes[“incidentid”] = new EntityReference(“incident”, guidCase);
        // Create the request to close the incident, and set its resolution to the
        // resolution created above
        CloseIncidentRequest closeRequest = new CloseIncidentRequest();
        closeRequest.IncidentResolution = IncidentResolution;
        // Set the requested new status for the closed Incident
        closeRequest.Status = new OptionSetValue(5);
        // Execute the close request
        CloseIncidentResponse closeResponse = (CloseIncidentResponse)iService.Execute(closeRequest);


To Cancel the Cases

       SetStateRequest request = new SetStateRequest();
       request.EntityMoniker = new EntityReference(“incident”, new Guid(strGuids[intGuid]));
       request.State = new OptionSetValue(2);
       request.Status = new OptionSetValue(6);
       SetStateResponseobjResponse = (SetStateResponse)iService.Execute(request);


Hope this helps.


Happy CRM’ing

Gopinath

6 thoughts on “Resolve and Cancel Cases in CRM/Dynamics 365 CE using C#

  1. Lead Generation March 31, 2018 / 11:04 am

    Very informative post. I really do hope for this stuff works! Great article. Keep it up. – Appointment Setting Companieshttp://leadgenerationservices.com.au/appointment-setting.html

    Like

  2. Unknown July 3, 2018 / 11:44 am

    CRM NEDİR ?CRM, bilgi teknolojileri odaklı bir kavram olarak görünmesine rağmen, CRM aslında yeni bir yönetim felsefesi ve kurumsal bir anlayıştır. Müşteri odaklı satış ve pazarlamanın ardından müşteri memnuniyetini maksimum seviyede tutmak anlayışının hâkim olduğu bu yönetim felsefesinde, uzun süreli müşteri ilişkileri ve müşteri sadakati hedeflenmektedir.https://www.crmkurumsal.com.tr

    Like

  3. RSoft December 20, 2018 / 5:36 am

    I Found your article very interesting I learned lot from your content So kind of you to provide us a knowledge of these important things really heplful, Thank you for sharing this vital information and tactics with us.

    Like

  4. samali March 2, 2020 / 7:50 am

    Hello there. I discovered your web site by way of Google while looking for a similar matter, your website came up. It appears good. I’ve bookmarked it in my google bookmarks to visit then.crm consulting firms

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s