Automate Duplicate Record Set Deletion

Business Problem

Salesforce provides a slick way to identify duplicates and merge them using Duplicate Rules and Matching Rules. When you create or edit a record that triggers the rule, a Duplicate Record Set record is created with at least two related Duplicate Record Set Item records. The Duplicate Record Set Item records represent the duplicate records that triggered the rule and the Duplicate Record Set record is the parent record. When you merge the Duplicate Record Set Item records through the merge process, the Duplicate Record Set (parent) record does not get deleted and you have to do a mass delete in order to clean up your org.

Tired of mass deleting your Duplicate Record Set records after you merge your duplicate records? We have created a free, unmanaged AppExchange package to take care of this immediately after you merge the Lead, Contact or Account records.

The package contains the following components:

  • Duplicate Record Set | Delete if Record Count = 1 (Record-triggered Flow)
  • Duplicate Record Set w/ Related Duplicate Items (Report Type)

How to Configure the App

  1. Install the AppExchange Package into a sandbox environment.
  2. Go to Setup | Flows and find the flow called Duplicate Record Set | Delete if Record Count = 1
  3. Click Activate.

That's it, you are ready to start testing!

How It Works

  • Here is the overview of the entire flow:

  • The record-triggered flow criteria is looking for the RecordCount field to have a value equal to 1. The RecordCount field is a standard roll up summary field on the Duplicate Record Set record that is counting the # of related Duplicate Record Set Items.

  • When the above criteria is true, the Duplicate Record Set record will be deleted. Super simple!

For any questions, comments, concerns – let us know in the comment section below!
We would love to hear from you!

Share This Story, Choose Your Platform!

About the Author

Cheryl Fernandes

Cheryl is a certified Salesforce Application Architect and is the Founder and Lead Salesforce Consultant at Blu Ninjas. She has been working with Salesforce for 12 years and has helped companies in financial services, insurance and beauty industries implement solutions on the platform. Flow is her favorite Salesforce declarative tool, it is a game changer for anyone who does not know how to code.

2 thoughts on “Automate Duplicate Record Set Deletion”

  1. Nice little Flow. I’m not sure what the utility is of the Report Type. What’s the intention there? I find a report type w/ Contact as the parent and a Duplicate Record Item as a child as more useful type.

    1. Hi John,

      Thank you for your comment! If we use a report type that filters for the Contact object only, we will not see the duplicate Lead records for Contacts. This was the reason we went for a generic report that is object agnostic.

Leave a Reply

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

Scroll to Top