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
To Cancel the Cases
Hope this helps.
--
Happy CRM'ing
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);
SetStateResponse
objResponse = (SetStateResponse)iService.Execute(request);
Hope this helps.
--
Happy CRM'ing
Gopinath