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!

Any comments, questions, concerns – let us know in the comments! 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 Lead Salesforce Consultant at Blu Ninjas. She has been working with Salesforce for 10 years and has helped companies in financial services, insurance and beauty industries implement solutions on the platform. Process builder and flow are her favorite declarative tools, these tools are a game changer for anyone who does not know how to code.

Leave a Reply

Your email address will not be published.

Scroll to top