Labels

Sunday, December 3, 2017

Dynamics 365 – Alternate keys can stop duplicates

Alternative keys give a method to stop users adding duplicates records, speed up Dynamics 365 searching and are useful for integrating Dynamics 365 with external services/systems.

Alternate keys can stop duplicates
  • Alternate keys can increase record lookup speed
  • Alternative keys allow you to lookup records without a GUID but with information which makes an alternate key.  E.g. lookup a person using surname and email.
  • Work well with upsert, allowing you to find a record and either update or create
  • Can sometimes cause problems when trying to remove them solutions
  • Added in Dynamics CRM 2016 and available in Dynamics 365 online and on premise

An alternate key can be added to an entity and can be made up of one or more fields on the entity.  Alternate keys use database indexes, this has the benefit of making records unique by stopping duplicates and increasing performance when retrieving records with an alternate key.




Alternate key facts
  • Each entity can have 5 alternate keys
  • You can only use strings, decimals and integers (whole number) to create an alternate key
  • There is a maximum key size to be aware of
  • After creating an alternate key, an async job will create the index and the status will be pending, In Progress, Active and failed.  If you have a lot of records this could take a long time.
  • You can retrieve an alternate key using RetrieveEntityKeyRequest, you delete an alternate key using DeleteEntityKeyRequest.

Stopping Duplicates
Alternate keys is they give a way to stop users adding duplicate records.  When you add an alternate key and a user tries to add a duplicate, Dynamics 365 will stop the user from adding the record and show the warning below.



 This is better than out of the box duplicate stopping functionality which only warns the user but lets them add a duplicate.
  

No comments:

Post a Comment