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 2 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:
- Install the AppExchange Package into a sandbox environment.
- Go to Setup | Flows and find the flow called Duplicate Record Set | Delete if Record Count = 1
- 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!