Accidentally disabling duplicate detection and auditing

When you import a Solution to Dynamics 365 (Dynamics CRM), you may accidentally be turning it off on the entity level, without even noticing it. (Make sure you double-check right now!)

Duplicate Detection and Auditing are two settings in Dynamics 365 (Dynamics CRM) which are enabled at two distinct levels: 1. Organization-wide and 2. entity specific.

If it's turned on on an entity but, turned off organization-wide, it doesn't work and vice-versa.

Suddenly turned off? Did you recently import a Solution?

When you import a Solution to Dynamics 365 (Dynamics CRM), you may accidentally be turning it off on the entity level, without even noticing it. (Make sure you double-check right now!)

This is caused by these settings being included as a part of the instructions in your Solution ZIP-file. When you export a Solution from a development organization, it's very likely that you had duplicate detection and auditing disabled there (on the entity level), this means your Solution ZIP-file will now also contain that information. When you go to import that Solution into your production organization, Dynamics is happy to oblige with all changes and instructions included in your Solution and disables it for your production too! Because that's what it said in your Solution!

What we can do to remedy this behavior

By far the simplest solution is to always double-check your duplicate detection and auditing settings after you import a Solution. Check it on the organization level and the entity level. For duplicate detection specifically, make sure to also check if your duplicate detection rules weren't unpublished.

A more technical approach would be to avoid this behavior in the first place, by cutting out those instructions from the Solution file.

Important disclaimer: It's risky to edit Solution files, proceed with extreme caution!

In your Solution ZIP-file there are two important XML files, the one we need to modify is customization.xml

Modify this file is Visual Studio, Notepad++ or any tool with full XML syntax highlighting, otherwise it'll be pretty tough to navigate.

Look for the element <entity Name="Account"> (or what ever entity you are looking for). Scroll past the <attributes> (this may be a long list) and look for these elements:

  1. <IsDuplicateCheckSupported>
  2. <IsAuditEnabled>

If these elements are set to 0 (number zero) change their value to 1 (number one)

Your customizations XML should now look something like this (lot of unrelated elements have been trimmed, it's a very big file):

<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Entities>
    <Entity>
      <Name LocalizedName="Account" OriginalName="Account">Account</Name>
      <EntityInfo>
        <entity Name="Account">
          <!--[trimmed]-->
          <attributes>
            <!--[trimmed]-->  
          </attributes>
          <IsDuplicateCheckSupported>1</IsDuplicateCheckSupported>
          <!--[trimmed]-->
          <IsAuditEnabled>1</IsAuditEnabled>
          <!--[trimmed]-->
        </entity>
      </EntityInfo>
      <!--[trimmed]-->
    </Entity>
  </Entities>
</ImportExportXml>

This doesn't fix everything, your duplicate detection rules may still get unpublished but, at least the entity level settings won't be turned off!