2

I have set up some duplicate rules on account object. These rules have identified potential duplicate accounts. I need to retrieve these potential duplicate accounts in code. Is there a way to do this?

3

You can query the DuplicateRecordItem table for all records that have the same DuplicateRecordSet. First, query for all DuplicateRecordItem entries for the record(s) in question, then query for all DuplicateRecordItem entries for any of the DuplicateRecordSet entries for those DuplicateRecordItem entries. In this way, you'll have all of the record Id values for all potential duplicates.

  • Thank you for the assistance. I have one more question. Is there something like matching score on potential duplicates? I have gone through DuplicateRecordItem schema but didn't find anything. – Mangesh Honale Mar 30 '17 at 10:22
  • 1
    @MangeshHonale No, the system is an all or none type thing, it doesn't assign scores. This is because the rules are built by admins, so admins have to define how specific records must match before they're linked as potential duplicates. – sfdcfox Mar 30 '17 at 14:19
  • I already had the same sense but just wanted to confirm this. Thanks anyway. – Mangesh Honale Mar 31 '17 at 8:13
  • I have observed a strange behaviour of this duplicate management system. I can see a lot of potential duplicates from lightning UI but when I look at DuplicateRecordSet and DuplicateRecordItem, I see only one DuplicateRecordSet with 3 records. Why is this happening? After setting up the matching and duplicate rules, will system identify duplicates from existing data or will only work on insert/update operations? – Mangesh Honale Apr 6 '17 at 11:32
  • @MangeshHonale If they show up in the UI, they should show in the API as well. The system is indeed supposed to mark all duplicates over time, even if those records are not modified. – sfdcfox Apr 6 '17 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.