Menu

How to stop duplicate detection rules unpublishing in Dynamics CRM / 365

Duplicate Detection Rules Unpublishing Dynamics

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 

Dynamics Duplicate Detection Rule Unpublished

3. Publish all

Publish Solution

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

Republish unpublished 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).

 

comments powered by Disqus

Download the solution to stop duplicate detection rules un-publishing automatically in Dynamics.

  • Stops duplicate detection rules unpublishing
  • Works with an unlimited number of rules
  • Works with all versions of Dynamics CRM 2016 (v8) and Dynamics 365 v9.