Enhance Data Deduplication with alternate keys

Alternate keys can be used for data integration purposes as well as deduplication and uniqueness validation. This post makes a special focus only on how adding an alternante key can help you keep your Customer Engagement instance data clean and avoid duplicates.

Deduplication with duplicate detection rules vs alternate keys

  1. Duplicate detection rules is an amazing feature which helps you set rules on your instance entity fields. It generates an alert popup whenever a user tries to save after a create or update operation if it meets a detection rule (for example creating a contact by filling in emailaddress1 with a value that already exists in the same field on another contact record will generate an alert popup if an exact match rule on contact emailaddress1 is published). Please check out this post for more details about Duplicate Detection Rules
  2. Obviously Duplicate detection rules DO NOT prevent users from creating duplicates, it simply shows an alert that can be ignored.
  3. Alternate keys DO NOT allow users to save if a duplicate is detected (2 records having the same value in the alternate key field)
  4. You can have up to 5 maximum alternante keys per entity
  5. You can have up to 5 maximum duplicate detection rules per entity
  6. System must first validate that alternate key is supported by the platform before it can be used
  7. Alternate keys fields must not have field-security level activated
  8. Data within the field should not contain any of the following special character (still work for deduplication but not for data integration)

    < > * % & : \\

  9. Only the following attributes can be used in alternate key definitions
Attribute Type Display Name
DecimalAttributeMetadata Decimal Number
IntegerAttributeMetadata Whole Number
StringAttributeMetadata Single line of text
DateTimeAttributeMetadata Date Time
LookupAttributeMetadata Lookup
PicklistAttributeMetadata Picklist

How to add a new alternate key?

Another dedicated post explains how to create an alternate key step by step here.

More details on this Microsoft docs link

Advertisements

[D365] How to create an alternate key

This post will show you how to quickly create an alternate key. If you want to know more about alternate keys please check out this post.

First you should open your customizations (either default solution or a dedicated solution that contains your customizations) and go to the entity where you want to create an alternate key.

In this post I’ll create an alternate key on contact entity using emailaddress1 field.

alternatekey

Select now one or more available attributes, I selected Email (emailaddres1)

selected attribute

Now you can save and close. A system job creates an index for Email in the database. The status changes from “pending” to “Active”

pending

active

You can now test your alternate key by creating two contacts with the same email address, while creating the second record you should have the following error

duplicaterecord

 

Mass import values from Excel file for your Option Set field

We usually need to populate an option set field with a numerous values (Countries for example). So typing 100 or more countries is at the same time a tedious and time wasting job. Here is a tip that can help you automatically populate an optionset without typing all the values. Let’s take for this example a list of countries and an option set field Country in Account entity.

  • First prepare your CSV file which contains your list of countries, give an easily recognizable name to Account Name column in order to delete all the records created later, then create this empty optionset field Country in Account.

countr_account country field

  • Now open the navigation bar and go to Settings->Data Management->Imports and start a new Import by clicking “Import Data”, click on browse to choose your CSV file to import then next to map your file with Account entity. Dynamics CRM automatically suggests to populate the field with the source values, otherwise you should map them yourself as you can see it in the screenshot below. mapped fields
  • Once the import is completed, you’ll notice that the Country_accountX records are created. You can open one of them check the Country values my accounts record created NOW DON’T FORGET TO DELETE THE Country_AccountX records to keep your CRM clean… Hope this can be helpful for you.