Some Dynamics 365/CRM record updates need specific workarounds. Due to various reasons such as adding new fields to case entity, option set changes, migrating data to some other environments etc… developers need to modify the case records including resolved cases. This post is to explain a workaround for updating and migrating Resolved Case records.
Get resolved cases using views or advanced find.
Export all the resolved case records using Excel Online.
Change the Status and Status Reason to any active status as follows. Save the changes and send the updates to Dynamics.
All the updates are sent as Data Import job and it is shown under Settings >> Data Management.
After changing Status\Status Reason, then Export them again and Update the fields needed.
Save the changes and send them to Dynamics through another data import job.
As Status and Status Reason have been changed to an active status, now those records need to be converted back to the Resolved status. This can be done from the CRM front end and Programmatically as well. Each case record needs a Resolution Reason during its Resolve process.
- Resolving the case from the CRM Front End
- Resolving the case using Code
EntityReference caseEntityReference = new EntityReference(“incident”, _caseIncidentId);
// First close the Incident
// Create resolution for the closing incident
IncidentResolution incidentRresolution = new IncidentResolution
Subject = “Re Resolution Test”,
incidentRresolution.IncidentId = caseEntityReference;
// Create the request to close the incident, and set its resolution to the resolution created above
CloseIncidentRequest closeIncidentRequest = new CloseIncidentRequest();
closeIncidentRequest.IncidentResolution = incidentRresolution;
// Set the requested new status for the closed Incident
closeIncidentRequest.Status = new OptionSetValue(5 /*ProblemSolved*/);
// Execute the close request
CloseIncidentResponse closeIncidentResponse = (CloseIncidentResponse)_service.Execute(closeIncidentRequest);
This is how Dynamics 365/CRM shows after the update process.