One key requirement of good Data Quality is a good duplicate prevention and merge process. Salesforce has introduced very powerful mechanisms like Duplicate and Matching-Rules for all SObjects. Unfortunately the full UI support and merge process seems currently only available for Leads, Contacts and Accounts. I'm asking for the roadmap in this question.

We actually need these features for other standard and custom objects.

Because I wasn't able to get any hints about the roadmap yet, we are trying to create the missing UI by using the DuplicateRecordItem. During that endeavor we run into unexpected issues or we are doing something wrong.

The following examples are based on Account to point out the issues and compare things to the standard UI. But the problems are the same for the other SObjects, where a standard UI is missing.


I've set up very simple Duplicate and Matching rules for Account:

  • it should fire on create and on change
  • it matches the Name field (exact match)

enter image description here

Now with the Standard Lightning Component "Potential Duplicates" everything works fine:

  • Example 1
    • If I create one Account called "abc" and an other one called "abc" it gets reported as dupe.
    • If I then rename one of these accounts from "abc" to "abc1" it'S no longer shown as dupe - fine, too!
  • Example 2
    • also if you first create the accounts "def" and "def1" and later rename "def1" to "def", a duplicate will be reported. Super fine and correct!

But if I query for DuplicateRecordItem

  • I still get the duplicate after giving abc1 is distinct name in Example 1
  • and no match for the two "def"s in Example 2.

To query the DuplicateRecordItem's, I use

SELECT Id, DuplicateRecordSetId, IsDeleted, Name, RecordId, 
    CreatedDate, CreatedById, LastModifiedDate, LastModifiedById 

It looks like DuplicateRecordItem gets only updated/created on create of the SObject for which the duplicate-rule exists (Account in these examples). In the first example, the DuplicateRecordItem-record will be created, but exists forever and in the second example, it will never be created...

It looks like that in action:

enter image description here

The first component in the right panel with the yellow icon is the Salesforce Standard "Potential Duplicates" and the one below with the pink icon is our custom compo based on DuplicateRecordItem and the query shown above.

Note that in our custom DuplicateRecordItem-based version, there is still a duplicate reported called "elastify GmbH & Co. KG". As you can see in the Account History, the current record was created as "elastify GmbH & Co. KG" and was later renamed to "elastify GmbH & Co. KG - Science Park". The Standard Lightning Component is getting that update, but DuplicateRecordItem seems blind for it.


  • Am I doing something wrong here?
  • If not, why is that so? Bug or feature?

If I don't make a mistake here, I would say that in the current condition the DuplicateRecordItem is practically useless.

As far as I see, DuplicateRecordItem is the only viable approach to create a custom lightning component for that purpose. Any other approach is welcome, too.

1 Answer 1


I asked around and @christian-carter indicated that the following statement is indeed true:

Is it true, that the Salesforce Standard Lightning Deduplication Component for Lead, Contact and Account is NOT based on DuplicateRecordItem, but on something else?

Again from Christian, the Lightning Component uses the dedupe function similar to what was formerly only available via the SOAP API findDuplicates().

With Winter '18 there are now the FindDuplicates, FindDuplicatesByIds, and FindDuplicatesResult Apex methods that you can use. See Find and Surface Duplicate Records in New Ways from the Winter '18 release notes.

The general indication was that DuplicateRecordItem was for use with historical reporting of duplicates. I agree that this is a bit confusing that the records it indicates may no longer be duplicates or that new duplicates may exist as the result of an edit.

As it is now, I suspect you will need to manually call FindDuplicates(sObjects) in Apex as required. It looks like you can also do full CRUD on DuplicateRecordItem records, so you could create/delete those as required.

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.