Merging Custom Entity Records with Dynamics CRM 2011 Dialog

Paul Nieuwelaar, 13 September 2012

Dynamics CRM 2011 by default includes the ability to merge 2 records into 1; however this functionality is only available on Accounts, Contacts and Leads. This is usually not a problem, however as CRM is designed to be fully customizable, there are some cases where you have an entity that needs the ability to merge records.

Instead of spending hours trying to reinvent the wheel by creating a custom ASPX or Silverlight screen to manage this functionality, I am going to show how we can replicate the Merge functionality on custom entities using a Dialog Process.

 Merging Custom Entity Records with Dynamics CRM 2011 Dialog

Basically the Dialog is run on 1 record, then using a Query you can retrieve all other records to select from (I've also included a search to filter more easily).

 Merging Custom Entity Records with Dynamics CRM 2011 Dialog

 Merging Custom Entity Records with Dynamics CRM 2011 Dialog

Once a matching record is selected, add a radio button prompt and response for each field you want merged, allowing them to select 1 of the 2 values.

 Merging Custom Entity Records with Dynamics CRM 2011 Dialog

After capturing all the responses, assign the appropriate value for each field into a variable (defined at the top). - This should be something like: If response value = 0, assign value to primary records value... otherwise If response value = 1, assign value to matching records value.

 Merging Custom Entity Records with Dynamics CRM 2011 Dialog

Once all variables are assigned, you can update the primary record with the new 'merged' values.

Next you want to deactivate the 'merged' record.

If you are merging owners, use an Assign step to select the new owner.

That's it! This will provide a quick and easy merge function, and it will be a lot faster than doing it in ASPX or Silverlight.

This is just another example of how powerful dialogs can be - they’re more than just a call script! We could even extend this further and merge records of different entity types, such and Leads and Contacts!

I've added a screenshot of the full Dialog process below:

 Merging Custom Entity Records with Dynamics CRM 2011 Dialog

Here are some additional resources to help with creating dialogs if you're not already familiar:

How to use Dialogs in Dynamics CRM 2011
Dynamics CRM 2011 Dialog Processes – Using Conditional Branches
Dynamics CRM 2011 Dialog Processes – Dynamically Querying CRM Data