What is Duplicate Detection in Microsoft Dynamics CRM?

Duplicate detection in Microsoft Dynamics is designed to help maintain data integrity. Duplicate detection rules can be configured for any entity and applied when:

  • creating a record,
  • updating a record,
  • during imports,
  • as a scheduled job.

The problem with duplicate detection rules un-publishing

Last week I had a client come to me with an issue in Dynamics CRM where duplicate detection rules keep un-publishing. 

When installing a managed or unmanaged solution for Microsoft Dynamics CRM, extra care must be taken to ensure that all components of the system work as expected.

The reason? Whilst duplicate detection rules are not solution components, they are automatically unpublished whenever you publish a managed or unmanaged solution involving one of the entities referenced in the rule.

The problem is that this can easily go unnoticed.

How to ensure that duplicate detection rules remain published in Dynamics CRM / 365

Whilst duplicate detection rules un-publishing is commonplace, the popular solutions to the problem wouldn’t work for my client as they can only handle up to six rules for each entity. The other issue with existing solutions is error handling.

Therefore, I created a more efficient solution, that would not error when there are more than 6 rules for an entity, and have packaged it to share with anyone else struggling with this issue.

This works with all versions of Dynamics CRM 2016 (v8) and Dynamics 365 v9.

By default, it will only publish Duplicate Detection Rules that have been unpublished within the last hour.  The plugin registration contains the FetchXml query that selects the Duplicate Detection Rules that need republishing.   This is to allow users to exclude certain rules based on other criteria, an example might be to ignore all rules where the name contains ‘[DISABLED]’

If the FetchXml is deleted the plugin will default to publishing all unpublished Duplicate Detection Rules.

Download the solution here.

How the solution works

1. Import our solution and enable “any SDK messages processes steps” in the import wizard

2. Post solution import, that changed the company record, some rules have become unpublished

Duplicate detection rules

3. Publish all

Duplicate Detection Rules

4. The solution publishes rules that were unpublished or modified in the last hour

Publish Duplicate Detection Rules

5.  There is verbose logging in the plugin trace log.  You can enable and see the trace log by following the instructions in this post. (follow from step 3).


Zachery Walsh O'Brien

Written By: Zachery Walsh O'Brien

Zachery is a Web Developer with a great eye for front end web development. He has studied Graphic Design, received a Higher National Diploma in Visual Communications, and interned as a Graphic Designer upon leaving college in a digital design agency in Ireland. Zachery originally focused on WordPress web design but has now diversified his skillset towards a web development role being able to leverage many front end languages and frameworks.

Similar Stories


AI

Private ChatGPT: 4 reasons to use it

The emergence of AI presents many opportunities to work more effectively and effectively, but there are also concerns relating to keeping information confidential within chatbot interactions. Here at XRM, we... Read More

AI

Simplify regulatory compliance with the AML Handbook Chatbot

In our previous blog post, we introduced the document search chatbot as a game-changing tool. Today, we’re delving into a specific use case—the AML Handbook. Aimed at simplifying Anti-Money Laundering... Read More

AI

Leveraging ChatGPT & AI to automate SVG icon generation for Dataverse

An overlooked, but important aspect of customising Dataverse tables and Dynamics 365 instances, is the icons that are involved. While the use of icons isn’t essential, not incorporating them creates... Read More