Call Us Now at 888-391-4493 x103

Preventing Salesforce Duplicates

Preventing Salesforce duplicates will save you heaps of time in the future. Just like any other CRM database, no matter how hard you try to keep them out, Salesforce duplicates (salesforce duplicate records) are going to happen.

Give your team the support they need! Download our Top 10 Ways to Better Support Salesforce Users guide!

A user may fail to search first before creating a new record in Salesforce.

A user may search Salesforce first but does not see the duplicate record due to Salesforce sharing settings.

Or a user (or admin) may upload files into Salesforce from a service with a tool that does not check for duplicate records. Either way, it is an ongoing process to keep the database clean.

preventing Salesforce Duplicates, Salesforce Partner, StarrForce, salesforce duplicate recordsSalesforce duplicates can cause all sorts of issues: from wasted effort to upset customers and user apathy.

  • Multiple reps could be working the same account without knowing it.
  • Reporting can be skewed from the extra records.
  • Customers could be contacted by different reps on the same subject, be it a sale or case.
  • All of this results in users eventually quitting using Salesforce since they have to wade through a bunch of records to find the proper one.

There are some steps you can take to keep Salesforce duplicates to a minimum including:

  • Instructing users on how to search before creating a record.
  • Limiting imports to only a few key people.
  • Using a third party app from the AppExchange like RingLead or Dupe Blocker.

Salesforce Enterprise users have an additional option using workflow and unique fields to create your own Salesforce duplicate record blocking tools.

What follows are the steps to stop Salesforce duplicate contacts from being created or uploaded regardless of your sharing settings. This does require a required field. For the contact records, I recommend making the standard “Email” field required on the page layout.

Create a new text field on the Contact object and call it something like “Duplicate Test”. Set the attributes so that it is unique and not case sensitive like the picture below. You do not need to add the field to any page layouts.

preventing Salesforce Duplicates, Salesforce Partner, StarrForce

Then create a workflow rule that fires “every time a record is created or edited” with the following formula criteria:


ISBLANK( Contact_Duplicate_Test__c ) ,

ISCHANGED( Email ) ,



You can change the “Contact_Duplicate_Test__c” to the name of the text field you created. You want the rule to look like the picture below with your field name in the place of mine.

preventing Salesforce Duplicates, Salesforce Partner, StarrForce

After saving the workflow rule, add a field update to update your unique text field with the following formula that concatenates the Last Name, a dash, and the email address: (picture below)

LastName  & “-” &  Email

preventing Salesforce Duplicates, Salesforce Partner, StarrForce

Activate the workflow and give it a test. In the picture below, you can see my test field on the bottom left.

preventing Salesforce Duplicates, Salesforce Partner, StarrForce

When I try to create a new contact with the same last name and email address, I get the error in the picture below and I am unable to save the record:

preventing Salesforce Duplicates, Salesforce Partner, StarrForce

Since the “unique” attribute works at a system level, this will work even if the user does not have permission to view the existing record. They could click the name link in the error but they would only get an error page that they do not have permission to view the record.

It also works when uploading records with the Data Loader or another tool. The Data Loader will return the failed uploads in the error file, allowing you to cross reference them to see if they need updating or not.

You can create the same setup on the Lead object as well using the same fields. Or you can use any other fields that are unique when combined. For accounts, you may want to use the Account Name combined with the Billing or Shipping Address Street and State. For opportunities, the Opportunity Name combined with the Account Name and the Amount may work for you. The possibilities are endless. You just want to make sure you are combining fields that result in a unique test string that would only be duplicated if the record was duplicated.


Want to learn more about clean data in Salesforce?

Download our FREE list of Salesforce Best Practices!

StarrData is a Salesforce Partner that helps companies deploy, optimize and support If you would like information on the services we offer call us at (888) 391-4493 Ext. 103.

Posted by Darren


Posted: May 17, 2012

view all posts

5 Comment

  • x
    April 11, 2013 at 4:50 am

    This is a very good article, it helped me a lot!

  • Jay Ess
    September 30, 2014 at 2:55 pm

    This was very helpful, but it appears this will only work AFTER the “Contact Duplicate Test” field has content. So this does not work for all of your pre-existing contacts. Please correct me if I’m wrong about this.

  • Darren
    October 1, 2014 at 1:49 pm

    Hi Jay,

    You are correct. Workflow rules only work on records edited after the rules are activated. Once activated, users will start getting the error as more and more records are edited and saved. If you would like to get a jump start on this, you can use the Data Loader to “Mass Touch” all records for the object where you placed this functionality. Below is a link to a Salesforce knowledge article with the steps to “Mass Touch” records (Edit and Save) without making any changes to the data:

    Knowledge Article Number: 000004602

    Title: How to trigger workflow rules on large group of records?


    Please keep in mind that the process described in this article WILL change the “Last Modified Date” and “Last Modified By” to the date/time of the mass touch and the user performing the action for all records. This may cause issues if you are using these fields in other functionality, like reports or formulas. You may also want to turn off any validation rules on the object while doing the mass touch so they do not prevent the saving of records. If you have other workflow rules on this object, you may want to deactivate them for this process so they do not fire inadvertently. Be sure to activate them once complete.

    If you do decide to do a Mass Touch after the workflow rule is active, and you have followed the instructions to set the rule to fire every time a record is created or edited, you will most likely get errors in the update process with the Data Loader. The Data Loader will generate an error file listing all of the records that could not be updated due to the new unique field. You can then use this file to decide if you want to merge or delete these records.

    If you end up with a lot of duplicate records, you may want to look at using a tool like RingLead’s Data Cleanse. You can get more information and a free trial of their products from the link below.

    We do database clean-up and optimization so please feel free to contact us if you would like some help with this or any other Salesforce issues.


  • Jay Ess
    October 28, 2014 at 11:00 am

    Thanks Darren. Very Helpful.

Comment Form

Your email address will not be published.

Scroll to Top
Click here to download our FREE Salesforce Best Practices Guide!