Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Best Practice to prevent duplicate record in crm 365

(0) ShareShare
ReportReport
Posted on by 195

Hi, I have a question, I want to prevent record in my entity to be duplicated actually, I already create a plugin that runs on pre-operation it's working but its buggy. Why its buggy? because when the record is created at the same time when I said the same time the difference between the creation of one record with another is only a matter of a millisecond. So when both are checking if the record with the same name is already created or not it will return false. I come with a solution to make my plugin runs on post-operation and make it asynchronous, but it will delete both records instead. Any suggestion for this? Thanks in advance 

*This post is locked for comments

  • keerthana katakam Profile Picture
    5 on at
    RE: Best Practice to prevent duplicate record in crm 365

    can i get the code you have written?

  • Community Member Profile Picture
    on at
    RE: Best Practice to prevent duplicate record in crm 365

    The only thing I'm not sure of is the merging of records part. I don't think business rules would be able to merge records together. I imagine that this could be handled through a custom plugin however we are completely native and that was part of the difficulty of my issue. Looking at your diagram I think that if it were me I would try to get someone familiar with creating a flow to take a look and see if it could be handled that way.

  • Jag S Profile Picture
    214 on at
    RE: Best Practice to prevent duplicate record in crm 365

    Hi Merry,


    Same here, I have multiple ways a registrant can sign-up from the portal as shown below. 

    Could we achieve the below with the business rules?

    Multiple-Sign_2D00_up.png

    Thanks

    Jag

  • Community Member Profile Picture
    on at
    RE: Best Practice to prevent duplicate record in crm 365

    In my case there were three different criteria in the workflow and the workflow kept triggering on a different one of the three and created duplicates. I tried the alternate key as well as a duplicate detection rule and those did not prevent duplicates. I created a business rule that evaluated for the various combinations of the three criteria and then added a simple yes no field on The entity and used to that in the workflow. I was able to stop the duplicates because once the value is yes the workflow no longer triggered.

  • Jag S Profile Picture
    214 on at
    RE: Best Practice to prevent duplicate record in crm 365

    Hi Keysersozeey,

    Did you find a solution as I have a similar issue.

    Thanks,

    Jag

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at
    RE: Best Practice to prevent duplicate record in crm 365

    Hi Merry,

    An alternate key is essentially created at the database level which signifies that from no matter where a record is getting created i.e manual, import, workflow, plugin , integration etc. the alternate key will be enforced.

    When you created the alternate key - the job was successful? I am referring to this : passion4dynamics.com/.../alternate-key-creation-stuck-on-pending-status  

  • Suggested answer
    crm development Profile Picture
    870 on at
    RE: Best Practice to prevent duplicate record in crm 365

    Hi Merry, As suggested earlier, write a Plugin on pre create of record. Check duplicate record and throw an exception. This will prevent from duplicate creation.

    Thanks,

    Anand

  • Community Member Profile Picture
    on at
    RE: Best Practice to prevent duplicate record in crm 365

    Soooo I have configured an Alternate key using only the name field (text) but the records in this particular entity are created by a workflow. The duplicates are still creating. My research is indicating that neither duplicate detection or alternate keys stop a workflow from creating records. Is this true? Is there anything else or any suggestions ANYONE can offer me? We are completely native.

  • Keysersozeey Profile Picture
    195 on at
    RE: Best Practice to prevent duplicate record in crm 365

    @Rawish Kumar

    Hi,

    Thanks for your answer i will look forward to it

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Best Practice to prevent duplicate record in crm 365

    Duplicate detection rules will warn you with duplicate records , but you can create and not prevent you to create.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans