Enable Javascript

Please enable Javascript to view website properly

Toll Free 1800 889 7020

Looking for an Expert Development Team? Take 2 weeks Free Trial! Try Now

Dynamics CRM Tips and Tricks – Using Alternative Key for Duplicate Search

Follow the Below Tips and Tricks

The duplicate detection feature was introduced long back in Dynamics CRM.

To enable it Navigate to Settings > Data Management and select Duplicate Detection Settings and select Enable duplicate detection option.

CRM tips

Next select Duplicate Detection Rules to either define the rule on which the duplicate detection rule should run or click on existing out-of-the-box rules.

Here open the “Contacts with same first name and last name” rule

CRM tips

Below you can see the rule criteria

CRM tips

To see it in action, you can try creating a new contact record with exact same first name and last name

CRM tips

Clicking on Save will allow you to create a duplicate contact record.

This is one of the limitations associated with the Duplicate Detection Rule along with other limitations like that. It works only for tables and not for phones, doesn’t work. When a lead is converted to account or contact using the qualify button and also there can be only 5 duplicate detection rules per entity.

Thankfully now you have an Alternate Key in Microsoft Dynamics CRM Development (introduced in CRM 2015 version), which you can use to prevent duplicate records to be created.

The basic purpose of the alternate key is to help define any other field apart from the GUID as the primary key for the entity. To match the external source in case of data migration.

Now let us define the alternate key on the First Name and Last Name field on the contact entity, similar to the above Duplicate Detection Rule.

Navigate to Customization > Customize the Entities > Entities and select the Contact entity and click on Keys.

Define the keys as shown below

CRM tips

Now try creating a new contact record with a duplicate first name and last name, you should get the below error message:

CRM tips

Defining alternate key makes sure that if records are getting created from code, then also check is applied i.e., server-side. Dynamics CRM services create a non-clustered unique index using the field defined in the database. One point we need to keep in mind is if any of the fields that are part of Alternate Key is blank or null. Then this check will not happen, and the record will not be identified as a duplicate.

In this article, we saw how easy it is to have duplicate detection in place without writing any code or specifically server-side code like plugins, custom workflow activity, etc.

Software Development Team
Need Software Development Team?
captcha
🙌

Thank you!
We will contact soon.

Oops! Something went wrong.

Recent Blogs

Categories

NSS Note
Trusted by Global Clients