Hi Everyone,
I am trying to create a utility (windows app) which will detect duplicates based on an existing "Duplicate Detection Rule" in Dynamics CRM and then will merge the records based on most recent record (modified on) found.
I am able to get the duplicates programmatically but I don't know how to identify the duplicate pairs i.e. which one is duplicate of which record.
My Present Code Looks Like This:-
BulkDetectDuplicatesRequest request = new BulkDetectDuplicatesRequest() { JobName = "Accounts with same Address", Query = new QueryExpression() { EntityName = "account", ColumnSet = new ColumnSet(true) }, RecurrencePattern = String.Empty, RecurrenceStartTime = DateTime.Now, ToRecipients = new Guid[0], CCRecipients = new Guid[0] }; BulkDetectDuplicatesResponse _response = (BulkDetectDuplicatesResponse)service.Execute(request); //Guid jobid = Guid.Parse("8549a21f-5b74-e811-8159-e0071b67aca1"); WaitForAsyncJobToFinish(_response.JobId, 150); QueryByAttribute query = new QueryByAttribute() { ColumnSet = new ColumnSet(true), EntityName = "duplicaterecord" }; query.Attributes.Add("asyncoperationid"); query.Values.Add(_response.JobId); //retrieve all the duplicates found by the system Job EntityCollection results = service.RetrieveMultiple(query);
Any Suggestions?
*This post is locked for comments