Tip #927: Duplicates when merging

When you merge two records you may receive the following cryptic message:

A record that has the attribute value {1} already exists. The entity key {0} requires that this set of attributes contains unique values. Select unique values and try again

What? Select where? That’s really confusing because the merge process is supposed to ignore the duplicates because one of the records is being deactivated.

Lucky for us, it’s not a generic SQL error and the answer is the mentioning of the entity key in the message. It refers to an alternate key that exists on the record. When alternate key is present, the unique index is created by SQL Server and that index trumps any business layer rules and duplicate detections that Dynamics 365 might have in place.

Effectively, you will receive the above message when you’ve selected the alternate key value from the subordinate record and are trying to merge it into the master record. Subordinate record will be deactivated but the value of the alternate key still there (and in the index) so any attempt to add the same value in the master record breaks the merge process.

Solutions:

  • Manually remove the value from the alternate key from the subordinate record and add it to the master.
  • “Swap” master and subordinate and merge into the record that contains the correct key value.

 

One thought on “Tip #927: Duplicates when merging

  1. […] These system errors are quite frequent, but they do get tricky to troubleshoot, when there isn’t the possibility to download the more precise error log. As I was researching the issue, I also found that Dynamics CRM Tip of the Day had also made a post about this or at least rather similar issue. So if my fix doesn’t solve your issue, then you should surely check out their tip #927. […]

Leave a Reply

Your email address will not be published. Required fields are marked *