When retrieving duplicates for an entity the total record count is not returning the expected result. Is this a bug or am I using this incorrectly?
Here is the relevant code:
Lead lead = entity.ToEntity<Lead>(); RetrieveDuplicatesResponse response = (RetrieveDuplicatesResponse)service.Execute( new RetrieveDuplicatesRequest { BusinessEntity = lead, MatchingEntityName = Lead.EntityLogicalName, PagingInfo = new PagingInfo { PageNumber = 1, Count = 50, ReturnTotalRecordCount = true } }); int duplicateLeads = response.DuplicateCollection.TotalRecordCount; int duplicateCollectionCount = response.DuplicateCollection.Entities.Count;
In this case I am getting back that the given entity has one duplicate record, which is expected. But duplicateLeads is -1; the parameter response.DuplicateCollection.TotalRecordCount returns -1 even though I set ReturnTotalRecordCount to true. But it definitely should not be -1 because response.DuplicateCollection.Entities.Count, the count of how many duplicates were returned in this page, is 1.
This is being executed against Crm 2016 online. Thanks for any help!