web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

RetrieveDuplicate WebAPI

(0) ShareShare
ReportReport
Posted on by 238

Hi, im attempting to use the RetreiveDuplicate WebAPI without much success. First off, to confirm my understanding, the RetrieveDuplicate WebAPI confirms whether a specific record is a duplicate (based on an existing Duplicate Detection Rule). If this correct?

I tried it in many different ways, i get: `"message""Resource not found for the segment 'RetrieveDuplicates'.",`

Im doing something like the below:

https://<ServerURL>/OrgName/api/data/v8.2/RetrieveDuplicates(BusinessEntity=@BE,MatchingEntityName=@MEN)?@BE={'@odata.type':'Microsoft.Dynamics.CRM.new_LogicalCollectionName','new_recordid':'DF6FC529-CF4A-EB11-8118-00155D1B8835'}&@MEN='new_LogicalCollectionName'

I have the same question (0)
  • JO-30091535-0 Profile Picture
    238 on at

    Wait, i actually missed the "PagingInfo" section. I added it but its also not working. I now get:

     "message""Resource not found for the segment 'Microsoft.Dynamics.CRM.new_LogicalCollectionName','new_Recordid':'DF6FC529-CF4A-EB11-8118-00155D1B8835'.",

    Right now, i have the following:

    https://<ServerURL>/OrgName/api/data/v8.2/RetrieveDuplicates(BusinessEntity=@BE,MatchingEntityName=@MEN,PagingInfo=@PI)?@BE={'@odata.type':'Microsoft.Dynamics.CRM.new_LogicalCollectionName','new_recordid':'DF6FC529-CF4A-EB11-8118-00155D1B8835'}&@MEN='new_LogicalCollectionName'&@PI={'PageNumber':1,'Count':50}

  • cloflyMao Profile Picture
    25,210 on at

    Hi Joe,

    The following format URL works for me.

    http:///OrgName/api/data/v8.2/RetrieveDuplicates(BusinessEntity=@BE,MatchingEntityName=@MEN,PagingInfo=@PI)?@BE={"new_countryid":"1b70b7be-354b-eb11-9c2b-001dd8be8ef3","@odata.type":"Microsoft.Dynamics.CRM.new_country"}&@MEN='new_country'&@PI={"PageNumber":1,"Count":10}

    cx.JPG

    Try replacing new_LogicalCollectionName with new_LogicalName instead.(The logical name of custom entity.)

    pastedimage1609398514070v1.png

    Regards,

    Clofly

  • JO-30091535-0 Profile Picture
    238 on at

    Hi Clofy,

    I actually tried both the logical name and logical collection name. Both are throwing the same error. I tried it with the format you provided. Same error. I also get the same error when testing the OOB contact entity (though i dont have a manually create dup rule for contact).

     "message""Resource not found for the segment 'DF6FC529-CF4A-EB11-8118-00155D1B8835\",\"@odata.type\":\"Microsoft.Dynamics.CRM.new_logicalname'.",
     "message""Resource not found for the segment 'A58EF23F-8917-EA11-8113-00155D1B8835\",\"@odata.type\":\"Microsoft.Dynamics.CRM.contact'.",

    https://ServerURL/Org/api/data/v8.2/RetrieveDuplicates(BusinessEntity=@BE,MatchingEntityName=@MEN,PagingInfo=@PI)?@BE={"new_logicalnameid":"DF6FC529-CF4A-EB11-8118-00155D1B8835","@odata.type":"Microsoft.Dynamics.CRM.new_logicalname"}&@MEN='new_logicalname'&@PI={"PageNumber":1,"Count":10}
    https:///api/data/v8.2/RetrieveDuplicates(BusinessEntity=@BE,MatchingEntityName=@MEN,PagingInfo=@PI)?@BE={"contactid":"A58EF23F-8917-EA11-8113-00155D1B8835","@odata.type":"Microsoft.Dynamics.CRM.contact"}&@MEN='contact'&@PI={"PageNumber":1,"Count":10}

  • cloflyMao Profile Picture
    25,210 on at

    Hi Joe,

    Try to run following code in console directly to check whether it works:

    var contactRecord = {
        "@odata.type": "Microsoft.Dynamics.CRM.contact",
        "firstname": "Clofly",
        "lastname": "Mao"
    };
    
    var pagingInfo = {
        "PageNumber": 1,
        "Count": 10
    };
    
    var context;
    
    context = Xrm.Utility.getGlobalContext();
    
    var requestUrl = "/api/data/v8.2/RetrieveDuplicates(BusinessEntity=@p1,MatchingEntityName=@p2,PagingInfo=@p3)";
    requestUrl  = "?@p1="   encodeURIComponent(JSON.stringify(contactRecord));
    requestUrl  = "&@p2='contact'";
    requestUrl  = "&@p3="   encodeURIComponent(JSON.stringify(pagingInfo));
    
    var req = new XMLHttpRequest();
    req.open("GET", context.getClientUrl()   requestUrl, true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
    
            if (this.status === 200) {
                var results = JSON.parse(this.response);
                console.log(results);
            } else {
                var errorText = this.responseText;
                console.log(errorText);
            }
        }
    };
    req.send();

    5822.aa.JPG

    If it could execute successfully, then you can copy the correct URL in Network > XHR.

    Regards,

    Clofly

  • JO-30091535-0 Profile Picture
    238 on at

    Happy New Years Clofly!

    I believe `getGlobalContext` doesn't work in 8.2 on-prem. I get `Xrm.Utility.getGlobalContext is not a function`

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I believe the reply was somehow copypasted from my post so you can check it - butenko.pro/.../

  • JO-30091535-0 Profile Picture
    238 on at

    Hi Andrew

    I reviewed the site and used the JS version. It doesnt work work for me. See below

    2021_2D00_01_2D00_01-15_5F00_03_5F00_49_2D00_.png

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I see no mistakes in your code. I believe you will have to do the troubleshooting on your side to figure out what exactly is wrong.

  • cloflyMao Profile Picture
    25,210 on at

    Hi Joe,

    Are you using Dynamics 2016?

    According to the article:

    https://www.xrmcoaches.com/2016/03/dynamics-crm-sdk-8-0-2-is-available/

    RetrieveDuplicates function was added with update roll 1, please check whether the function is supported in your current version.

    Regards,

    Clofly

  • JO-30091535-0 Profile Picture
    238 on at

    My current version is Update 2.5 (8.2.5.0004)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 196 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans