• Home
  • About
    • Leadership
    • Partners
    • Blogroll
  • Force-Squared Blog
    • Tips and Tricks
    • Configuration
    • Development
  • Support
    • Knowledge Base
    • Submit a Case
  • Is It Dreamforce Yet?

X-Squared On Demand

Salesforce solutions delivered

  • Home
  • About
    • Leadership
    • Partners
    • Blogroll
  • Force-Squared Blog
    • Tips and Tricks
    • Configuration
    • Development
  • Support
    • Knowledge Base
    • Submit a Case
  • Is It Dreamforce Yet?
  • Tips and Tricks
  • Configuration
  • Development
You are here: Home / Salesforce CRM / Duplicate Record Item Enrichment and Auto-Deletion Code

Duplicate Record Item Enrichment and Auto-Deletion Code

February 28, 2022 by David Schach Leave a Comment

TL;DR: Check out code to enrich DuplicateRecordItem records and to handle extra DuplicateRecordSet records after merging duplicates at https://github.com/dschach/duplicatehandling

I love the standard Salesforce duplicate records feature (Trailhead: https://trailhead.salesforce.com/content/learn/modules/sales_admin_duplicate_management H&T: https://help.salesforce.com/s/articleView?id=sf.managing_duplicates_overview.htm) and have used it extensively, both to prevent duplicates and to track/report on duplicates for later management.

Image from Trailhead

If your org is set to allow duplicates to be created and to report on them, then you’ve probably gone to the Duplicate Record Set tab and looked at the sets there, used a report to see all the sets, or clicked on the “Possible Duplicates” component on a record page.

Reporting & Duplicate Record Item Enrichment

Unfortunately, reporting on Duplicate Record Items is difficult because it doesn’t show enough detail about the duplicates themselves. If you want to group by any attribute other than the record name or Duplicate Rule, you’re out of luck. Wouldn’t it be nice to have some code to enrich your Duplicate Record Item object to include a proper lookup to the records so you can make custom report types to include, say, the Record Type or the Contact Email?

I’ve created an easily-installable bit of Apex that you can put into your sandbox and promote to Production, and you can give it a test-run in a scratch org if you’d like.

Unnecessary Duplicate Record Set Auto-Deletion

Once you’ve chosen to merge those duplicates, then good job! You’ve removed some clutter from, say, the Contact object… but you may inadvertently have left some clutter on the Duplicate Record Set and Duplicate Record Item object!

Though you started with one DR Set and two DR Items, and you merged the two Contacts, Salesforce doesn’t clean up the no-longer-needed Set/Item combo. So I wrote some code that removes that single, lonely, unnecessary set. After all, you’ve done a good job, so why shouldn’t you be rewarded with the removal of that reminder of once-dirty data? This code fixes that!

Head over to https://github.com/dschach/duplicatehandling and give it a whirl! Instructions are in the README, and full code documentation is at https://dschach.github.io/duplicatehandling/.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to email a link to a friend (Opens in new window) Email

Related

Filed Under: Apex, Native Application, Salesforce CRM

← Lightning Component With Running User Information Prevent Duplicate Emails on Leads →

Share Your ThoughtsCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Is it Dreamforce Yet?

Find out!

Find us on the AppExchange

Mass Update Contacts 2.0

Get It Now

Recent Posts

  • Prevent Duplicate Emails on Leads
  • Duplicate Record Item Enrichment and Auto-Deletion Code
  • Lightning Component With Running User Information
  • ChatterBINGO is Now Open-Source
  • Display Only My Role’s Records on a Report

Post Categories

Popular Tags

#df09 #df10 Akismet Apex AppBuilder AppExchange Appirio Astadia Blogs Chatter Configuration Content DreamFactory Dreamforce Eclipse IDE Enterprise Force.com Builder Force.com Platform Google Infowelders Integration Just for fun Lightning New Developments New Features Partner Program PersonAccount Projects Publisher Salesforce Salesforce1 Salesforce for Google Apps sfdcverse Sites Visualforce Web-to X-Squared On Demand

Find Us Online

  • Twitter
  • Facebook
  • LinkedIn
  • RSS

Subscribe

RSS Feed Comments

Subscribe via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 164 other subscribers

Copyright © 2008–2025 X-Squared On Demand · Genesis Framework by StudioPress · WordPress · Log in

 

Loading Comments...