Adding Case Resolution and CaseFields to the Case Form in Dynamics CRM

Adding Case Resolution and CaseFields to the Case Form in Dynamics CRM

In Dynamics CRM, when the Case is resolved a new form is required to be filled in which captures the resolution items as shown in the image below:

Case_Resolution_Fields

These fields are hard to get access to as they are stored in a hidden Entity called IncidentResolution. If you want to use the Case Resolution or Case Remarks values on a workflow or view or form, you will need to copy the values to case Entity fields using a plugin when the case is resolved.

The steps to do so are provided below:

  1. Create 2 new fields on Case entity : new_CaseResolution and new_CaseRemarks
  2. Write a plugin on the creation of IncidentResolution entity and copy the values to Case entity fields.
  3. Register the plugin as shown in the image below:

incidentresolution
Source code for plugin is given below:

//Run Plugin

var targetEntity = plugin.TargetEntity.ToEntity<IncidentResolution>();

if (targetEntity.IncidentId != null)

{

Incident caseToBeUpdated = new Incident();

caseToBeUpdated.Id = targetEntity.IncidentId.Id;

plugin.Tracer.Trace($”Case ID: {caseToBeUpdated.Id}”);

//capture the Case Resolution Fields

if (!string.IsNullOrEmpty(targetEntity.Subject))

{

caseToBeUpdated.new_CaseResolution = targetEntity.Subject;

plugin.Tracer.Trace($“Case Resolution: { caseToBeUpdated.new_CaseResolution});

}

if (!string.IsNullOrEmpty(targetEntity.Description))

{

caseToBeUpdated.new_CaseRemarks = targetEntity.Description;

plugin.Tracer.Trace($”Case Remarks: { caseToBeUpdated.new_CaseRemarks}”);

}

plugin.Tracer.Trace(“Updating Case”);

service.Update(caseToBeUpdated);

}

 

408 total views, 1 views today

About Author

Ricky Saini

Ricky Saini
Dynamics CRM, SharePoint, Office 365, Windows Azure and .Net Architect/Consultant/Freelancer in Australia ( Melbourne, Sydney and Canberra)

Leave a Comment