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

Featured Post

Improving MS CRM Performance

Performance on MS CRM is always a crucial thing and we may follow different ways to achieve the performance thing. Below is the one more a...