How to prevent duplicate records in salesforce using validation rule


The most common way to prevent record creation or updates in Salesforce is through a validation rule. But can a validation rule prevent duplicates? The short answer: no. A standard validation rule can only use specific record data, so it can’t find potential duplicate records. But pairing a validation rule with a before save flow can! Salesforce’s order of operations gives us an opportunity to execute a flow before validation rules fire. This means we can perform checks, and trigger a …

The most common way to prevent record creation or updates in Salesforce is through a validation rule. But can a validation rule prevent duplicates? The short answer: no. A standard validation rule can only use specific record data, so it can’t find potential duplicate records.Apr 26, 2021


Table of Contents

How to handle duplicate records in Salesforce?

Once your data is squeaky clean, the best way to handle duplicate records is to prevent duplicates in Salesforce from being created in the first place. There are many tools that can do this, but there is on available in Salesforce for free and it is very easy to setup and use.

What is a Validation rule in Salesforce?

Written By… Lucy Mazalon Lucy heads up Operations at, Founder of THE DRIP and Salesforce Marketing Champion 2020. Validation Rules in Salesforce verify that the data entered by a user meets certain criteria before the user can save the record.

Why do you need a duplicate management strategy for Salesforce?

It is essential to implement a duplication management strategy for your Salesforce instance, to avoid future problems. Salesforce natively has tools to help discourage or inhibit users from entering duplicate data across any device.

How do matching rules work in Salesforce?

Let’s look at how matching rules work in Salesforce. We developed our standard matching rules to return the best possible set of match candidates for business accounts, contacts, leads, and person accounts. Here’s an example of some of the matching criteria we include for contact and lead records.


How do I restrict duplicate records in Salesforce?

In the Standard Lead Duplicate Rule, select Block instead of Allow. With the Standard Lead Duplicate Rule set to block duplicates, a rep can click to view duplicates of leads but can’t save a new lead. Prevent reps from creating duplicates of records they don’t have permission to view.

How do I activate duplicate rules to identify potential duplicate records in Salesforce?

From Setup, use the Quick Find box to find Duplicate Rules. To edit a rule, click the rule name, and click Edit. To create a rule, click New Rule, and select the object you want the rule to apply to. Enter the rule details, including a name, description, and record-level security settings.

How do I restrict a validation rule in Salesforce?

Click on new Button to create new validation rule in Sample object.Enter Rule Name.Click on Insert field and enter the syntax.Check Syntax whether it has any errors or not.Enter Error message.Enter Error location.Now click on Save button.

How do you prevent duplicate records in set?

1. If you add student to the set that is identical to existing student in the set, the new student will run over the existing student and you won’t have duplicates in the set.

How do you prevent duplicates in a Salesforce report?

Bypass sharing rules if needed – if you want to match on all records, change Record-Level Security to Bypass sharing rules. 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.

How do you prevent duplicate cases in Salesforce?

0:426:59Salesforce Solution: Prevent Duplicate Cases – YouTubeYouTubeStart of suggested clipEnd of suggested clipSo we’re going to come in here we’re going to click on the gear icon. We’re going to click setup. WeMoreSo we’re going to come in here we’re going to click on the gear icon. We’re going to click setup. We’re going to pull up the case object. We’re going to click on case we’re going to click on fields

How many types of validation rules are there in Salesforce?

There are five types of Rules in salesforce and the priority of each rule is according to their order.

Can we use permission set in validation rule?

By referencing the custom permission in the validation rule, Addison implemented a better design that avoided hard-coded permission management in the validation rule. Rather, permission management to edit advisor accounts is done via permission sets, which can be delegated to non-system administrators to manage.

When can a validation rule be used to prevent invalid data?

When records are edited by a user – If a user is updating any records user might know or might not know what kind of information needs to be entered into the fields.So validation rule can be used here to prevent invalid data.

Which will avoid duplication of records in a database?

You can prevent duplicate values in a field in an Access table by creating a unique index. A unique index is an index that requires that each value of the indexed field is unique.

How do you deal with duplicate data?

Three techniques businesses can use to remove existing duplicate records within their database include:Standardize contact data. … Define the level of matching. … Utilize software to identify duplicates.

Does group by remove duplicates?

SQL delete duplicate Rows using Group By and having clause In this method, we use the SQL GROUP BY clause to identify the duplicate rows. The Group By clause groups data as per the defined columns and we can use the COUNT function to check the occurrence of a row.

How to create duplicate rules?

Just like a matching rule you can create a duplicate rule first by defining a name and description (optional) after you choose the object the rule is for. Next you can set the record level security. When it’s enforced it will only consider records the current user has visibility to for potential matches.

Why do I get duplicate records in Salesforce?

It can happen because someone didn’t search properly for an existing records before creating a new one. It can happen because an import spreadsheet wasn’t cleaned before data was created. Regardless, duplicate records are the bane of every CRM environment.

Why is data important in Salesforce?

Your data is one of the most important aspects to making your Salesforce implementation successful. When data is structured incorrectly, not complete, or simply not visible to the right people, your adoption and usability of the platform decreases dramatically. One of the common issues every customer experiences is duplicate data.

What does “Ignore Alert” mean?

The Save (Ignore Alert) only displays if you’re not blocking duplicates in the Duplicate Rule. You may need to create multiple Matching and Duplicate rules depending on your data and the issues you experience. Don’t wait until everything is perfect to start using Duplicate Management.

What is matching rules?

Matching rules is where you define when a record may be a potential duplicate. There are a few rules already built, but you’re going to want to build your own. Creating a new rule is easy. You provide a name, description (optional), and then define your criteria with drop down menus.

Can you manually merge duplicate records in Salesforce?

You can manually review and manually merge duplicate records in Salesforce. This is viable if you’re overall data set is pretty small. For most companies , this is simply not feasible.

Rules for Duplicate-Free Data

Matching rules and duplicate rules work together to ensure that your sales teams work with data that’s free of duplicates. Before your reps save new and updated records, matching rules and duplicate rules provide warnings of potential duplicates. You manage matching rules and duplicate rules in Setup.

Activate a Matching Rule

We provide standard matching rules for you. If you established your instance of Salesforce for Winter ’15 or earlier, like Maria, you activate the standard rules you want to use. Maria, however, wants to activate standard rules for only accounts and leads. She has other plans for her contacts, which we cover after this procedure.

Create a Custom Matching Rule for Contacts

For contacts, Maria wants to include fuzzy matching for the Mailing Street field.

Block Duplicates with Fuzzy Mailing Streets

Before an active matching rule can do anything, you pair it with a duplicate rule. You can include up to three matching rules in each duplicate rule, with one matching rule per object.

Report on the Creation of Duplicate Accounts and Leads

Maria doesn’t block reps from creating duplicates for accounts and leads. So Lincoln wants to see the quality of account and lead data and how well the duplicate rules work. To help Lincoln, Maria sets up custom report types.


Use these resources to learn more about matching rules and duplicate rules.

Hands-on Challenge

You’ll be completing this challenge in your own hands-on org. Click Launch to get started, or click the name of your org to choose a different one.

When Should I Use Validation Rules?

Use Validation Rules to maintain user input data, or system modified records.

Sales Cloud Validation Rules

Sales reps aren’t the greatest fans of data input. To keep your Salesforce data quality on track, use Validation Rules to guide users while working with Sales Cloud objects.

Service Cloud Validation Rules

Service agents have enough to juggle while assisting customers on the phone, email, chat, or the many other channels they are expected to monitor.

Top Tips for Working with Salesforce Validation Rules

Ideally, admins should prepare/design automation/integrate systems respecting active Validation Rules. However, having a way to toggle which users should bypass Validation Rules is very useful.


This guide has covered when to use Validation Rules, how to create them, and 14 Validation Rule examples that are ready for you to implement in your org.

Prevent your users from entering duplicate records

Salesforce natively has tools to help discourage or inhibit users from entering duplicate data across any device. Duplicate management rules in Salesforce help identify potential duplicates records across accounts (business & person), contacts, leads & custom object records.

Identify if there are duplicate records within your org

Now rules have been set up to prevent duplicates from being created; you want to clean up any potential double-ups you already had in the system. We recommend using an app from the Salesforce AppExchange as a quick and easy way to understand the duplicate records within your system.

Clean up any duplicate records

The apps mentioned above all have the functionality to merge and delete duplicate records. There is also the ability to merge records natively within Salesforce.

Speak to the experts

If you find that large volumes of your records are duplicates or finding that the quality of your data is lacking, you should look to engage a data specialist. We recommend reaching out to Database Consultants Australia (DCA) to discuss the state of your data and how you can improve it further.


Leave a Comment