Set up duplicate detection in three layers and in this order: the matching definition, then the duplicate rule response, then the alert the user sees. Test each layer against a fixed set of records that should match and records that should not, and do not switch a rule on until its results match the expectations written down beforehand.
Why the order of setup changes the outcome
Duplicate detection works as a chain. The matching definition decides whether two records look alike on the chosen fields. The duplicate rule decides what happens on a hit, and the alert decides what a person reads at the moment of save. Configure the outer layers first and you test behavior that has not been settled yet, so a response that looks right in isolation fires on the wrong records once the inner layer arrives.
Step-by-step setup order
Work through these stages in sequence. Each one produces a written decision that the next one depends on, so record what was chosen and why as you go.
Step 1: Define the object and the duplicate it must prevent
List the objects in scope. For many teams that means accounts, contacts and leads, plus any custom object that holds the same real-world entity. For each one, write a sentence describing the duplicate to prevent. A contact duplicate is often a second record for the same person with a different email address. A lead duplicate is often one person arriving through two forms on the same day. These two problems need different identifying fields.
Step 2: Choose the fields that identify a record
Pick the smallest set of fields that separates one real-world entity from another. Email address and company domain carry strong signal for people. A name alone is weak, because common names collide. For accounts, a registered name by itself matches unrelated companies that share a common word, so the web domain and billing postcode usually add the evidence that the name lacks. Note which field decides the match and which fields support it.
Step 3: Decide how each field is compared
For each chosen field, decide whether the comparison must be exact or close. Exact comparison suits identifiers such as an email address once its formatting is standardized. Close comparison suits names and street addresses, where spelling and abbreviations vary between users. Start strict and widen the definition when the test set shows a real gap. Record the threshold you chose and the reason for it.
Step 4: Define the duplicate rule response
Choose what happens on a hit. This is a business decision, not a default to accept, and the next section covers the trade-off between blocking and warning. Write the response for each object separately, because a lead and an account carry different levels of risk when they are duplicated.
Step 5: Write the alert text and the next action
The alert is the text the user reads at the point of save, so it has to carry the whole message. Name the existing record, state the reason for the flag in plain terms, and point to the next step. Check that the users who will see the alert can open the existing record, or the warning leads to a dead end.
Step 6: Set the activation sequence
Finish and test the matching definition first, then the response, then the alert, because each layer depends on the one before it. Turn on one object at a time, so a fault traces back to one area and a rollback touches one area of the data model.
Choosing between blocking a save and alerting
A blocking response stops the record from being saved until the user resolves the conflict. It protects the data at the cost of friction. An alert lets the save go through and asks the user to review the match. It keeps work moving, but duplicates can slip through when warnings are dismissed without being read.
For a first-time setup, start with an alert on each object and reserve blocking for cases where a duplicate causes concrete harm, such as two records receiving the same invoice or two owners contacting the same customer on the same day. Run the alert for a trial period, count the overrides, and move a rule to blocking once the override rate falls. A high override rate usually points to a match that is too broad, not to careless users.
Ask three questions about each object before choosing a response:
- What goes wrong if two records exist for the same entity?
- Who is blocked by a false positive, and how many times a week would that happen?
- Is there a merge or review step that cleans up a duplicate after it is created?
If a cleanup path exists and the cost of a duplicate is small, an alert is usually enough. If there is no cleanup path and the cost is high, blocking is easier to justify, and that matching definition needs the most testing before go-live. For how duplicates that already exist get sorted, see the data steward duplicate review routine.
Test records to run before activation
Build the test set before anything is switched on. Include records that should match, records that should not, and edge cases where a small change in the definition alters the result. The set exists to surface the cases the definition gets wrong, because those are the cases that cause trouble after go-live.
Use these six groups:
- Exact duplicates, with identical identifying fields. The rule should catch each of these.
- Near duplicates with a spelling variation in a name, a shortened company suffix or a different legal form ending.
- Same name, different entity. Two people with the same name at different companies, or two companies that share a common word.
- Same entity, changed identifiers. A person who moved to a new employer and a new email address, or a company that uses two web domains.
- Records with a blank identifying field. Decide what the rule does when a key field is empty, then test that decision directly.
- Records that arrive through an integration or a bulk import, since these often use different formatting from records typed in by hand.
Write the expected result for each record before running it. Compare the actual result with the expectation and log each difference. A difference is either a fault in the rule or a gap in the expectation, and it must be resolved before you move on. Do not change an expectation to match what the rule produced unless you can state the reason in one sentence.
Keep the test set in a sheet that can be rerun in full. When a matching field changes, rerun everything, not just the new cases, because a change to one field can alter the results for records that passed before.
Checks after activation
Activation starts measurement. In the first few weeks, track the alerts fired, the share that users dismiss or override, and the duplicates that still get created. The third number shows what the rule missed, and the first two show whether the rule is too noisy to be read.
Review a sample of overridden alerts with the data owner. If overrides cluster around one field or one source, tighten the matching definition for that source. If duplicates keep arriving from one integration or form, check whether the rule applies to that path at all. If duplicates arrive through a path the rule does not check, adjusting the threshold will not catch them.
Keep a dated change log for each adjustment, with the reason and the test-set result. Changes to the processes that touch the same records should be planned alongside the rules, so that sales workflow design and service workflow design are reviewed against the same matching definition rather than against separate assumptions.
For help planning this work, see Salesforce implementation.
Questions about sequencing, thresholds and sign-off
Should matching rules be configured before duplicate rules?
Yes. The duplicate response acts on what the match returns, so the match has to be defined and tested first. Working in the other order means the response logic rests on an assumption that has not been checked against real records.
How many fields should a matching definition use?
Use the fewest fields that separate the same entity from a different one. Two strong identifiers are usually easier to test and explain than five weak ones, because each additional field is another place where a formatting difference can break a match that should succeed. Add a field when the test set shows that the existing fields miss a real duplicate.
Why does a duplicate sometimes get through an active rule?
A common cause is a blank key field, which gives the match nothing to compare, or a value stored in a different shape on one entry path, such as an import or a form that saves the same detail in another format. Check the records that slipped through against the fields the rule reads, not against the fields you expected them to contain.
Should existing records be cleaned up before activation?
Treat cleanup as a separate process from activation. Activation changes how new saves are checked. It does not merge or alter records that already exist. Running the current data through the candidate match before go-live shows the size of the existing problem and gives the test set real cases. If the existing data came from a migration, the data migration and integration work is the place to check formats before the match is tested.
Who should approve the matching definition?
The owner of the data for that object should approve it, with input from the people who create the records. Sales operations is usually the team that knows how contacts enter the system, and the service or finance team knows which duplicates cause real harm. Get written sign-off on the field list and the chosen response before activation, and store that sign-off with the change log.