Hide Duplicate Detection

By | August 18, 2011

In my current CRM 4.0 project we don’t allow users to create and run duplicate detection jobs. All we want is for the duplicate detection to run when they manually create or update records. We also use duplicate detection rules when processing new leads through a custom workflow.

The users have been removed permissions to create duplicate jobs. The only permission they have is Read at Organization level. I tested removing additional permissions but this causes duplicate detection in the situations mentioned above to fail.

This permission level does not allow the user to access the duplicate detection options under Settings which is great but we noticed that several of them were still creating duplicate detection jobs and with that we were having major performance issues every time they would do that.

After further investigation we found out that they were still able to create jobs through the option Duplicate

Duplicate Detection options

Detection under Tools and also the same option after you run an Advanced Find.

After consultation with Microsoft we were told that this was by design and would not be changed in CRM 4.0 or CRM 2011.

Our business still wanted us to find a way to hide these options from the user so we went ahead and made the changes to the necessary out-of-the-box pages which as everyone knows are absolutely not recommended by Microsoft.

In any case, here are the changes we had to make. I added custom jQuery code to the following pages:

  • _root/bar_Top.aspx
  • CRMWeb/loader.aspx
  • AdvancedFind/AdvFind.aspx
_root/bar_Top.aspx code
 
$(function () {
$(window).load(hideOption(event));
});
function hideOption() {
$('#_MIopenStdDlgToolsDuplicateDetectionaspxnull600500').hide();
};
</script>
<!-- ********** -->
AdvancedFind/AdvFind.aspx
 
<script language="javascript" type="text/javascript">
  $(function () {
    $('#resultFrame').load(hideOption);
  });

  function hideOption() {

    $('#resultFrame').contents().find('#_MSsubdetectDuplicates').hide();
  };

</script>

<!-- ********** -->
CRMWeb/loader.aspx
   
 
  <script language="javascript" type="text/javascript">
    $(function () {
      $('frame[name="stage"]').load(hideOption);
    });

    function hideOption() {

      try {
        $('#_MSsubdetectDuplicates',top.frames["stage"].document).hide();
      } catch (e) {
      }
    };

  </script>

  <!-- ********** -->

You can download the modified files here.

Leave a Reply