Skip to main content
Partner Stories

How to merge duplicate records in Dynamics 365 CE without breaking related data

A merge in Dynamics 365 CE moves the related records of one record onto another and deactivates the record you didn't keep, so it is fair to ask what could break. This article covers what a merge changes, how to check each change on a small sample first, and a safe order of work for the full cleanup.

The worry is reasonable. A merge touches more than the two records you can see on screen: their child records, their parent links, who has access to them, and anything else in your environment that points to them.

Key takeaways

  • A merge moves child records to the record you keep and deactivates the other one. It also affects parent links, access, documents, and automations.
  • Native merge covers Account, Contact, and Lead records, two at a time, and the merge dialog can't take the parent account, parent customer, or owner from the other record.
  • Write survivorship rules first, then merge about ten test pairs in a non-production environment and compare before and after.
  • Clean up in stages with a stop rule, and back up before the first production batch.

What a merge changes

A merge changes six things beyond the field values you see in the dialog, and Microsoft documents most of them. Know each one before you run a batch.

What a merge touchesWhat Microsoft documentsWhat to check first
Child recordsThe record you keep inherits all of the other record's child records (admin guide). For tables that can be merged, the relationship's merge behavior must be Cascade (relationship behavior).List the related records on both sides by type. After a test merge, confirm the surviving record shows both sets.
Parent linksA merge can stop with a "differently parented" or "might lose its parenting" error, and the person merging can turn off the parent check in the merge dialog (relationship behavior). The parent account and parent customer columns don't appear in the merge dialog (merge duplicate rows).Compare the parent of each record before you pick the survivor. Treat a parenting error as a reason to review the pair, not an error to switch off.
AccessIn Microsoft's Account examples, after a merge the owner of the deactivated record can read both the surviving record and the deactivated one. Users on the deactivated record's access team or owner team are not added to the surviving record's team (admin guide).Note who owns and shares each record. After a test merge, check access with a user from each side.
The deactivated recordIt is deactivated, not deleted (admin guide).Check any report, flow, or integration that looks records up by name or ID, because the old record still exists as inactive.
DocumentsMerging records that have a SharePoint document library merges the records, not the libraries (merge duplicate rows).Check where each record's documents live and plan to move them.
AutomationsMicrosoft doesn't list which automations run during a merge. It does say a cascade job that pauses after repeated failures can point to problems with existing plug-ins, data, or workflows (relationship behavior).List the plug-ins, flows, and workflows that act on the related tables and include them in your test merge.

Two environment database settings, GrantFullAccessForMergeToMasterOwner and GrantSharedAccessForMergeToSubordinateOwner, change the access results. Ask your administrator which values your environment uses before you test.

The interface also limits what you can merge. It works on Account, Contact, and Lead records only, two records at a time (merge duplicate rows). The Web API adds Case (Web API merge).

Decide which record survives before anyone merges

Write down your survivorship rules first, because the merge dialog turns every pair into a judgment call and different people will judge differently.

Start with the record you keep. A rule beats a gut feeling, and these are common ones:

  • Keep the record with the most related records, so fewer links have to move.
  • Keep the record that came from your main source of truth.
  • Keep the oldest record when nothing else separates the pair.

Then set a rule for the field values. In the native dialog you choose, column by column, what to take from the other record, and data in those columns may override what the record you keep already has. For each column that matters, decide whether the surviving value always wins, whether the other value fills a gap only when the surviving one is empty, or whether the most recently updated value wins.

Some columns can't be taken from the other record at all. Microsoft lists the parent account column on Account, the parent customer column on Contact, and owner columns among those that don't appear in the merge dialog. If the other record has the better owner or parent, fix that on the surviving record before you merge.

One page is enough: the rule for choosing the survivor, plus a rule for each column you care about. Everyone who merges works from the same page.

Test on a sample in a non-production environment

Merge about ten pairs in a non-production environment that holds a recent copy of your data, and compare before and after, so you find surprises there and not in production.

  1. Choose pairs that cover the risky cases. Include a pair with the same parent and a pair with different parents. Add a pair where one record has many related records, a pair with documents attached, a pair owned by different users or teams, and a pair with related custom tables.
  2. Record the before state. For both records in each pair, note the count of related records by type, the owner, the parent, the users it is shared with, and where its documents live.
  3. Merge using your written survivorship rules. Follow the rules exactly, including the column rules. Write down any pair where the rules didn't give a clear answer.
  4. Compare the after state. The surviving record should show the combined related records. Check its parent and owner, then open it as a user from each owner's side to confirm access. Check that the documents are where you expect.
  5. Check your automations. Look at the run history of flows and workflows tied to the related tables, and at any plug-in logs. A merge changes related records, and Microsoft doesn't list which automations that fires.
  6. Fix the rules and repeat. Adjust your survivorship rules, then merge a fresh set of pairs. Move on when the sample merges the same way each time.

A safe order of work for the real cleanup

Run the cleanup in stages, with the same checks after each stage and a rule for when to stop.

  1. Back up first. Take an environment backup before the first production batch, and confirm with your administrator how a restore would work and who can start one.
  2. Start with a small batch of high-confidence pairs. Pick pairs that match on a strong identifier, such as the same email address on two contacts, so you are not also testing your matching rules.
  3. Validate with the same checks as the sample. Compare related record counts, parents, owners, access, and documents on a handful of merged records from the batch.
  4. Set a stop rule. If a check fails, or an error mentions parenting or a failed cascade, stop and review before the next batch.
  5. Scale in batches and keep a log. For each merge, record the pair, which record survived, who merged it, and when. A log makes any later question quick to answer.
  6. Measure again and close the entry points. Re-run your duplicate count to confirm the rate dropped. Then deal with whatever keeps creating duplicates, or the cleanup is temporary.

This order works with native merge. The limit is volume: the interface merges two records at a time, so thousands of pairs means thousands of manual decisions, and different people will make them differently.

Where merge rules and thresholds come in

Native merge asks a person to apply your survivorship rules by hand, two records at a time. Rules that apply themselves, and a cap on which pairs merge automatically, are what a merge tool adds.

Plauti builds data quality software for Dynamics 365 CE. Finding and merging duplicates is part of Clean, the stage that fixes what's wrong. You set a master record rule, which decides the record you keep, and field rules, which decide which values win. Both apply to every merge, whether one person merges a pair or a job merges many.

For automatic merges, you set a minimum matching percentage, and only pairs that score at or above it merge. Plauti's documentation recommends a percentage near 100% because you don't see each planned merge beforehand. Lower-scoring pairs stay in the job for manual review (Auto Merge documentation).

The same documentation is direct about limits. Related records are reparented to the surviving record whenever possible, but timeline auto-post metadata can't be merged. A setting lets you name relationships to leave out of a merge. And merging, including auto-merging, can't be undone, so test on a sample and back up first, as you would with native merge.