Sunday, 8 July 2018

D365 - Alternate Keys for Duplicate detection



Recently, I came across few scenario's where I needed duplicate detection for some of the Primary keys from multiple systems.

MSCRM alternate Keys are handy in performing duplicate detection and the alternate keys are primarily used for simplifying Integration and Migration activities. On top it implements the unique constraint for a columns or combination of columns and this can be an robust alternate to duplicate detection rules in few scenarios.


Points to Keep in Mind while designing:

  • Alternate Key allows Null values. 
  • Alternate Keys can be composite
  • Alternate Keys can be used for upsert, retrieve, update and delete. 
  • Do not go for too many alternate keys, this may impact performance as each key will be an index in DB. Seems to be a filtered index in DB


Setting up an alternate key(Copy pasted from MS blog):
To define the alternate keys, go to Go to Settings > Customizations.. Choose Customize the System > Components > Entities > Entity <X> > Keys. Choose New. On the form, fill in the required fields (Display Name and Name) and then choose and add the fields to the key. Save the key. In the example shown here, we used the Account Number field in the alternate key definition.
Define alternate key for the account entity

No comments:

Post a Comment