Considerations for Merging Duplicate Records in Dynamics CRM

Duplicate records can enter the system in various ways from user input, during data imports, integrations and legacy data. They are not only an obstacle in achieving the single source of truth for the customer that is essential for CRM, but also impact user experience, reporting as well as integrations. Dynamics CRM provides ways to address duplicates entering the system with duplicate detection rules which will prompt the user on creation of the duplicate record if they want to save or merge their newly created record. Duplicate records can be identified automatically when a duplicate detection job returns a list of duplicate record with matching values specified in the duplicate detection rules. Duplicate Detection jobs can be run on record creation, Data import and also on a scheduled basis providing the ability to Merge.

The Merge function is only available for Leads, Contacts, Accounts and Case records and provides a much better alternative to deleting duplicate records allowing you to retain historic interactions and related data of duplicate records such as notes, activities, contacts, opportunities and any other custom child records.  You can also merge any 2 records from the entity views without using duplicate detection. If you select more than 2 records to merge, the Merge button will become deactivated. Only active records can be merged, if you want to merge with another inactive record you will have to reactive it before merging. During the merge process the duplicates child records are re associated to the Master, and any lookups that previously were set to the duplicate will now lookup to the master, and the duplicate record will become inactive.

Before Merge



After Merge


In the following example, I have 2 Duplicate Accounts and also a third Account that references duplicate Account 2. Selecting the 2 accounts I want to merge will display the Merge button;



The first important step of Merging is Identifying the Master record which will be the remaining active version of the record that will inherit the duplicate records subordinate records. The Merge presents you with a list of fields from both records, allowing you to identify the Master record as shown below;



A list of common fields that are populated on both records will be rendered as in the view above, the first allowing you to select any field values you want to keep from the duplicate onto the master. Once you identify the Master the second record will be regarded as the duplicate. The Master record is the one you would like to remain active and inherit all child records and activities from the duplicate. The merge screen display the fields common on both records allowing you to select individual values you believe should remain on the remaining master record once the record regarded is deactivated. We can also do this programatically by setting the property on the MergeRequest Class UpdateContent. As you can see, it also allows you to map any Lookup fields such as Primary Contact etc, however all lookups are available to map and override, except for Owner. The Record Owner cannot be changed during the merge process , the Master records owner will always remain as the owner unless it reassigned after the record is merged already.

There is an option at the bottom of the screen which allows you automatically select to keep the Master fields that have data, keeping the master values as priority.

The Automatic Merge feature will appear only during duplicate detection, this allows you to skip the field mappings screen and will merge all the child records of the duplicate record to the Master, keeping the master records existing field values. 



Once you Click OK to complete the merge, any changes to the record fields as well as its subordinate child records including Contacts, Activities, Notes, Opportunities and any other child custom entity records will be reassociated to the new Master record you specified in the Merge, and the Modified date would also be updated. Now when you go into the deactivated record, it will no longer have any activities, notes or child records associated. There will have all been re-parented to the Master record you selected in the first step.



Also notice any Lookups referencing the duplicate record will now lookup to the Master, so there should no longer be any lookups referencing the duplicate record after it has been merged.

Merging 2 contacts from different accounts will re-associate to the Master Contacts Parent Account, and the Parent Accounts Primary Contact Lookup updates to the merged contact if the previous primary account was the duplicate. You will have to make some consideration when merging contacts In many cases there may be duplicate contact records linked to various different accounts, Often it may be because the contact relationship is different for other accounts or it may be that the contact record is being used to store different information.

The Record Owner cannot be changed during the merge process , the Master records owner will always remain as the owner unless it reassigned after the record is merged already.

Iv noticed the displayed Completed by Person for Activities on the Duplicate record will change to the person merging the record when they get assigned to the Master Record, however the owner of the activity will remain the same as the Master.

Please ensure the Merging user has the Merge security Privilege as well as Read, Edit, Append, Append To, and Share


Merging your Contacts and Accounts is an important way for creating a single view of the customer, and is a vital aspect to your CRM strategy. One of my ongoing projects for the XRMToolbox is the Auto Bulk Merge utility, which provides a simple way to identify your Master and defining merge rules. I would love to hear your feedback.

Author: Raz Dynamics
Razwan is a Microsoft MVP and Dynamics 365 Community Moderator responsible for developing Microsoft Dynamics 365 and CRM integrated solutions for over a decade. Razwan is responsible for delivering Dynamics 365 User Groups & CRM Saturday Conferences. Raz has developed many free community utilities for Dynamics 365 and CRM which you can download from this blog.