For Everyone

Duplicate Records in Salesforce?

9 min read
CloudAnswers photo

Maintaining a clean and consistent database is important to keep a business running smoothly. But it requires a never-ending process of removing duplicates, cleaning bad data, enhancing records, backing up data, and many more related activities. In today’s post, we’re going to talk about one of the first things to start with - removing duplicate records.

Duplicate records are almost unavoidable, especially when you have data coming from multiple sources or multiple users like most CRM systems. But they are stress agents. Imagine calling a prospect only for them to reply that your company reached out earlier. Or telling a customer that you didn’t get their order just to realize that you were looking at the wrong record for them. Or sending someone several emails because you have multiple leads for them. There are many ways that duplicates can hurt your reputation and directly impact your bottom line.

Therefore, it is vital to remove duplicates from your system. And when it comes to duplicate removal, there are plenty of options. A search for duplicates on the AppExchange provides over 260 results! So where should you start? Read on to hear about some options you can use for free to start preventing and merging duplicates in Salesforce. If you’d rather have someone else put together a recommendation specifically for your company you can schedule some time to talk.

Salesforce Duplicate Rules

Most Salesforce editions come with Duplicate Management, a way to alert users about duplicates. Duplicate Management requires setting up Duplicate Rules and Matching Rules (although some are set up by default).

  1. Duplicate Rules answer the question: what happens if a duplicate is identified? These define what happens when someone views a duplicate or tries to edit or create a duplicate.
  2. Matching Rules answer the question: what is a duplicate? These define what fields and criteria are used to match records. Matching Rules are used in Duplicate Rules.

The standard account duplicate rule, one of the defaults that come with Salesforce. The Matching Rule is referenced in the Duplicate Rule.

Customizing Matching Rules

Matching rules are the best place to start since they determine what defines a duplicate. Before sitting down to create these rules, make sure to review your data and talk to your team. Some things to think about or discuss with your team:

  • What fields are populated when records are created? You don’t want to create a matching rule that uses the Website field, for example, if you never fill in that field.
  • What fields help identify which records aren’t duplicates? There are a lot of scenarios where you might want to allow records that are similar, so identifying unique fields like Email or Address can help avoid matching records that aren’t actually duplicates. You can also use a field for a related object, like Account on Contact, to limit the potential duplicates to only those on the same related object.
  • How broad do we want the potential duplicates to be? When setting up rules you can cast a wide net or small one. If your users are well-trained and familiar with merging records you can make your matching rules broader and let the users decide if a record is a duplicate or not. Otherwise, you can set up stricter rules and users will get less warnings about potential duplicates.

To set up your Matching Rules, follow these steps:

  1. In Salesforce Setup, search for Matching Rules on the left menu
  2. Click New Rule to create a new rule or click Edit to edit an existing rule. Note: Rules that are active cannot be edited, deactivate the Duplicate rule and the Matching Rule to edit. Standard rules cannot be edited.
  3. Choose the object that the matching rule is for.
  4. Enter a rule name and select the fields and matching method for each one. For details on the matching methods, check out the Salesforce help.
  5. If you have advanced logic (like match on Name and Address OR Email), then click Add Filter Logic to enter the logic.
  6. Save and activate your rule. Depending on the amount of data and Salesforce’s current server load, the activation could take a while to generate keys for all of the records.

That’s it, you now have a matching rule that you can use in your duplicate rules.

An example duplicate rule to prevent duplicate pets.

Customizing Duplicate Rules

Now that you have matching rules, you can decide what happens when they find a match. To customize Duplicate Rules search for Duplicate Rules in Salesforce Setup. Like Matching Rules, there are a few things you may want to consider before setting these up:

  • Should duplicates checks bypass sharing? If records are private in your org you’ll have to decide if you should bypass sharing. If you bypass sharing it still doesn’t show the user records that they don’t have access to, but it could prevent them from creating a duplicate even though they can’t see the original.
  • Do we want to prevent the creation of duplicates, warn users, or report it to admins? Your organization will have to decide how strict you want to be with duplicates, and this should be discussed in conjunction with your matching rules. If you have strict matching rules it is easier to decide to block users from creating duplicates, otherwise you may just want to alert them. And if you don’t want to bother your users, just report the duplicate but allow them to create or edit it.
  • Do we have any automated processes that should not be blocked from creating records? If you have web-to-lead or a similar process that is creating records you may not want to throw an error since that would prevent the record from coming into the system at all. Make a list of these so you can exclude them using the conditions.

To set up a Duplicate Rule, follow these steps:

  1. In Salesforce Setup, search for Duplicate Rules on the left menu.
  2. Click New Rule and choose an object or edit an existing rule. To edit a rule, you have to deactivate it first.
  3. Name the rule - if you plan to have a lot of rules, consider a naming convention so it’s easier to find the rule you need to edit.
  4. Bypass sharing rules if needed - if you want to match on all records, change Record-Level Security to Bypass sharing rules.
  5. Choose what happens on Create and Edit. If you want to prevent duplicates, choose Block. Otherwise, choose if you want to Alert the user or Report the duplicate. Enter your Alert message if needed.
  6. Choose your matching rules. Note that you can use multiple matching rules and can even compare records with a different object (for example Contacts with Person Accounts).
  7. Specify your conditions, if applicable. This is a good place to filter out any automated processes, for example, you could avoid blocking the web-to-lead records by setting a condition for Lead Source not equal to “Website”.
  8. Save and Activate.

That’s it, now go test your new rule and see if it works correctly.

Viewing Duplicates

Now that you have your duplicate rules set up, you might want to view the duplicates that were found.

Viewing Duplicates on Reports

To report on the duplicates, you’ll need to create a new report type and then create a report.

  1. Go to Report Types in Setup
  2. Create a new Report Type
  3. Choose the object that has duplicates as the primary object (i.e. Leads, Contacts, Your Custom Object)
  4. Relate Duplicate Record Sets to the primary object.
  5. Save the report type and create a report.

Viewing Duplicates on Records

One of the best ways to keep up with duplicates is to display them prominently on the records so that users can see them and merge them if they are allowed. In Lightning Experience, Accounts, Contacts, and Leads come with a pre-built component for this. If you’re trying to use a custom object, or just want a little more control over the component, install our free Potential Duplicates Component.

If you don’t see potential duplicates on a page, here’s what to do:

  1. If you haven’t already, install our potential duplicates component from the AppExchange.
  2. Open up a record that you want to see duplicates on.
  3. Click the gear icon in the top right and click Edit Page to launch the Lightning App Builder.
  4. Drag the Potential Duplicates component onto the page wherever you’d like.
  5. If desired, specify the columns that you want to display on the component or on the merge screen.

The Potential Duplicates Component

Merging Duplicates

If you happen to be on Performance or Enterprise edition, you can use Salesforce’s Duplicate Jobs to leverage your Duplicate Rules and merge records. If not, you’ll have to decide if you want to develop a tool to merge duplicates, use something from the AppExchange, or let users merge the records.

If you installed the Potential Duplicates Component in the last section or have the standard duplicates component on Leads, Accounts, or Contacts then you can start merging records immediately. Just open any record that has a duplicate and click the Review and Merge button to open the merge screen. You can start from a report on potential duplicates from the last section then click into one of the records to merge from the potential duplicates component. Otherwise users can view and merge duplicates as they are working in the system.


Maintaining a CRM system with accurate data is critical for any business to succeed. Removing duplicates is one of the easier ways to improve data quality, and a huge benefit to the users and the businesses’ financials. For those just getting started with duplicate management, start with setting up Duplicate Rules and Matching Rules to prevent or identify duplicates, then figure out a plan to merge them and keep it clean moving forward.

CloudAnswers photo

About CloudAnswers

Salesforce apps, powerful components, custom development, and consulting. Our experienced team helps you to create and modify workflow processes in salesforce.

Related Articles

For Everyone

How to edit the Opportunity Team in Salesforce?

An Opportunity Team is precisely what it sounds like: a group of individuals working together on a single opportunity. It gives you 100% control over who is working on what contact/deal/transaction and their responsibilities.

November 27, 2021

5 Min Read

For Everyone

Flows vs Workflows vs Process Builder - Process Automation in Salesforce

Historically, providing a smooth customer experience has been difficult, time-consuming, and frustrating with manual procedures and disparate systems. However, with a 360 degree view of the customer and a bit of automation, it is all easier. This article discusses process automation in Salesforce, how it can help businesses, and actionable tips.

November 18, 2021

6 Min Read

For Everyone

Salesforce Marketing Intelligence Report - Key Insights.

Without question, turning to data to help develop and maintain businesses is vital. Intelligent data is the lifeline and facilitator of success, whether it’s reacting to changing consumer behavior during and after the COVID-19 epidemic...

October 22, 2021

5 Min Read