Tip #1028: Prevent duplicate contacts the Viking way

Marius “CRM Viking” Pedersen gave us a great tip about how to prevent duplicate contacts from being created in Dynamics 365:

I set emailaddress as alternate key on contact once. That actually worked very well to prevent duplicate contacts from being created. It also required that all contacts must have an email address.

You have to start with clean data, either at the beginning of a deployment, or deduplicate your contacts, as you cannot create an alternate key on a field that contains duplicate data.

An additional benefit is that when you use the web api the email is an alternate key, so you can retrieve and update data using the emailaddress1. So if you push data from your ERP solution you don’t have to create a mapping between MSDYN customerid and ERP customerid.

Want to be cool and fearsome as the CRM Viking? Send your tips to jar@crmtipoftheday.com.

5 thoughts on “Tip #1028: Prevent duplicate contacts the Viking way

  1. Phil says:

    Just be aware that inactive records are still considered when checking the keys.

  2. Adele says:

    Great tips. I consulted your tips a lots. Thanks
    I have a requirement that alternate key only applies to active records, not on inactive records. Do you have any tip how to implement? Thank you

    • Hi Adele,

      not sure what you mean by applying alternate key to active records only. The alternate key is just a unique index. Do you mean that you need to enforce uniqueness only on active records?


      • Olly says:

        Yes George, how would you do that?

        • Alternate keys are not going to work for you in this scenario, you’d have to enforce uniqueness in some other way. The one possibility is to create a new email field (or use emailaddress2 or emailaddress3 if they are not used) and then create a real-time workflow (or maybe just Power Automate flow) triggered when a record gets deactivated and move email address to that field. That would force inactive records to stay out of the index. Sounds like another tip coming! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *