Duplicate Detection in Dynamics 365 using Keys

A superb way of restricting duplicate record creation is using Keys in Dynamics 365CE. This is definitely one of the most useful and easy to use features in Dynamics CRM.

In this example, I will create a Key for Email (emailaddress1) field to ensure there are only unique record values for this fields in my environment.

Create Key

It’s pretty straight-forward like creating any other Dynamics CRM component. Navigate to Keys under and entity like shown below –

And add a new Key and select attributes you want to use for that key

Finally, save and publish your changes.

How it Works

Let’s say you already have an existing record ABC 1 with email address abc@abc.com

And if you try to create/update a record with the same attribute’s same value, you’ll get and error as below –

And the error will be

Hope this quick tip helps!

Duplicate Detection in CRM 2013

What is Duplicate Detection feature?

  • In order to maintain integrity in data in our system, it is a good practice to reduce duplicate data. To do so, MS Dynamics CRM provides facility to do so.
  • Duplicate Detection needs to be enabled from Settings > Data Management > Duplicate Detection Settings.
  • Default duplicate detection rules are defined for accounts, contacts and leads but not for other types of records. To enable duplicate detection on other types of records, we need to create new rules.


Enable Duplicate Detection

  • We can enable Duplicate Detection for our organization under Settings > Data Management > Duplicate Detection Settings as shown below.



  • As shown above, Duplicate Detection first needs to be enabled organization wide.
  • Then we can chose on what the duplicate detection should be enabled.
    1. When a record is created or updated.
    2. When the CRM for outlook goes from offline to online and,
  • 3. During data import


Duplicate Detection Rules

  • There are predefined rules already available in Duplicate Detection Rules for account, lead and contact.



  • Likewise we can create new rules of our own with certain criteria to run of other types of records. In order to create new rules, select New.
  • For the new Duplicate Detection Rule, give a suitable name. Set Base Record Type to the entity you want the duplicate detection rule to run on. And provide Matching Record Type to compare the record to for the rule to run.




  • We can optionally chose to compare with having the Case-Sensitivity and to Exclude inactive matching records.
  • In the above example, we want to detect duplicate records with same customer name being created on Employee. So, we’ll set the criteria for our rule to run the duplicate detection.



  • In the example above we have 2 criteria for the duplicate detection rule to run. These criteria are ANDed i.e. both should satisfy to detect duplicate records successfully.
  • First, we are comparing the Name for its exact match and then we are checking the Address for its first 5 characters to be the same.
  • We can also optionally chose to ignore blank values. In this case, we are not doing so.
  • Once done, we can Save and Close the duplicate detection rule.
  • So, our newly created rule appears in the list of Duplicate Detection Rules. It hasn’t been published yet. So it won’t detect duplicated unless we Publish it.
  • publishDDRules


  • To do so, select the rule we just created, and Publish it.
  • Let’s check the duplicate detection rule we just published.
  • example1Now, We have 2 records in employees Andrew and Samuel. We shall try to create another employee named Samuel with same address to force CRM to detect a duplicate on creation of a new Employee record.
  •  On saving this record, CRM will throw a warning that it detected duplicate of the record that we are trying to create.




  • So here, it has detected a duplicate records that matched the rule we created for name and address of the Employee. If we want the duplicate record to be created nonetheless, we can click on Save to do so.
  • Cancelling it will avoid the duplicate record being created and we can go back to our record to change it before it is saved.


Hope it helps you! 🙂


Another post on Duplicate Detection jobs is coming up soon. Will update you once done. Keep checking this area. Thanks!