Blog, Development

How to Retrieve Duplicates using WebApi

In this post I provide 2 ways to retrieve duplicates – using plain JS way and with usage of Xrm.WebApi namespace that was introduced as a part of 9.0 release.

So here is plain JS:

And here is Xrm.WebApi version:



  1. Hi Andrew,

    I have used same webApi method (just Copy-Pasted) to retrieve duplicates in online trial environment. I’m getting error like “Resource not found for the segment ‘Retrieve Duplicates'”. Do you have any Idea ?

    1. Hello,
      I checked and it works fine for me. What exactly did you do with code and where you tried it?

  2. Hi…I have not modified anything, just used your code as it is in my custom Js file. my online trial version 9.1

    Here is the method I’m calling on form load and getting error “Resource not found for the segment ‘Retrieve Duplicates’”

    this.retrieveDuplicatesWebApi = function () {
    var contactRecord = {
    “@odata.type”: “”,
    “firstname”: “Andrew”,
    “lastname”: “Butenko”

    var pagingInfo = {
    “PageNumber”: 1,
    “Count”: 10

    var retrieveDuplicatesRequest = {
    BusinessEntity: contactRecord,
    MatchingEntityName: “contact”,
    PagingInfo: pagingInfo,
    getMetadata: function () {
    return {
    boundParameter: null,
    parameterTypes: {
    “BusinessEntity”: {
    “typeName”: “mscrm.crmbaseentity”,
    “structuralProperty”: 5
    “MatchingEntityName”: {
    “typeName”: “Edm.String”,
    “structuralProperty”: 1
    “PagingInfo”: {
    “typeName”: “mscrm.PagingInfo”,
    “structuralProperty”: 5
    operationType: 1,
    operationName: “RetrieveDuplicates”
    function success(result) {
    if (result.ok) {
    var results = JSON.parse(result.responseText);
    //you’ve got results to results variable
    function (error) {
    var errorText = error.message;
    //handle error here

  3. Hello, i have the same issue as Praveen. “Resource not found for the segment ‘Retrieve Duplicates”
    So strange, i tried almost everything and didn’t managed to solve the problem. Andrew is there any chance you expirienced and solved this issue somehow?


    1. Юрий,
      I tried the “Xrm.WebApi way” and it doesn’t work anymore for some reason but the old-fashioned way with the use of XmlHttpRequest still works.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.