Jul 6, 2020

Why Duplicate Detection job is impractical

Idea of Duplicate Detection Jobs of Dynamics 365 is with great value. It allows you to monitor the number of Duplicate records in a given time: so necessary action could be taken.


Setting a job is very easy because it allows you to select the entity (type with a Duplicate Detection Rules are set) and mention which View is selected to run against. Most importantly scheduling is possible. Once you schedule it, you will get a new report after each execution.


This is where frustration starts. For example, I am trying to monitor how fast duplicate Contacts are being grown by checking a report every week. Below is a sample report. D365 instance I am monitoring already got thousands of duplicates.

First I was surprised to see number 12. Then I realized, 12 is nothing, but the number of records showing in this page. (at least it could have been 10!, what is 12 anyway..)  Then I had to click next and go on. The simple mistake in this window is, it doesn’t show the total number. For me, it was a hectic task click next again and again to check the number of records.


Anyway, I ended up writing a console application to read the number of records in the report. Below is the Fetch Xml I used for it. May be this will help you too.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
    <entity name="duplicaterecord" >
        <attribute name="duplicateid" />
        <attribute name="createdon" />
        <order attribute="createdon" descending="true" />
        <filter type="and" >
            <condition attribute="createdon" operator="on-or-after" value="2020-07-03" />
            <condition attribute="createdon" operator="on-or-before" value="2020-07-06" />
        </filter>
        <link-entity name="asyncoperation" from="asyncoperationid" to="asyncoperationid" >
            <attribute name="name" />
            <attribute name="createdon" />
            <filter type="and" >
                <condition attribute="name" operator="like" value="%Weekly Duplicate Monitor Job: Active Contacts%" />
            </filter>
        </link-entity>
    </entity>
</fetch>


No comments:

Post a Comment