Sitemap

Wednesday, November 22, 2017

Close an incident or case in MS CRM

To close incident record we need to update statecode, for this generally we do use SetStateRequest but this will works only for cancel the case or incident not for close or resolve. Below is the code snippet to close an incident.

                    CloseIncidentRequest closeIncidentRequest = new CloseIncidentRequest();
                    Entity incidentEntity = new Entity("incidentresolution");
                    incidentEntity.Attributes.Add("incidentid", new EntityReference("incident", caseId));


                    closeIncidentRequest.IncidentResolution = incidentEntity;
                    closeIncidentRequest.Status = new OptionSetValue(statusReason);
                    CloseIncidentResponse closeIncidentResponse = (CloseIncidentResponse)service.Execute(closeIncidentRequest);


No comments:

Post a Comment