Solutions4sf I build CRMs, and fix the ones that broke

Sales Cloud · duplicate rules

The same company, saved twice.
The rule compared the wrong things.

A Salesforce duplicate rule misses the same company when its matching rule compares fields that are stored differently, most often one phone number typed in two formats, or fields the record does not have at all. Fix the data the rule reads before tuning the rule, and decide separately what must be blocked and what only needs a warning. This is how to find which of the seven causes you have, what blocking and warning each do to a person and to an integration, and what was built for an industrial services group, a holding and its operating companies.

Object Reference and Metadata API Developer Guide, Winter ’27, and Trailhead read on 16 November 2026. Reviewed 16 November 2026.

The cause

Why does a Salesforce duplicate rule miss an obvious duplicate?

Because it sees only what its matching rule compares, in the way the rule compares it. Several fields in one matching rule must all match unless filter logic says otherwise, a blank field matches nothing by default, and +44 7700 900123 and 07700 900123 are two different strings. The rule runs correctly and finds nothing.

The first two behaviours are in the MatchingRuleItem entry of the Object Reference for the Salesforce Platform, Winter ’27, last updated 6 November 2026, read 16 November 2026, and in MatchingRule in the Metadata API Developer Guide of the same version and date, where blank values default to not matching. The table puts the seven causes on one screen, each with the place you can see it.

Five of the seven reasons a Salesforce duplicate rule misses the same company, each with where to see it and what fixes it: fields joined by AND (use OR when one field is enough), a field the record does not have (a blank never matches), one phone number in two formats such as +44 7700 900123 and 07700 900123 (store one format on save, then compare exactly), a rule still activating (test once RuleStatus reads Active) and a rule that only reports (turn the alert on). Fix the data the rule reads before tuning the rule.
Five of the seven causes, one order of work: fix the data the rule reads, then tune the rule.

Why one customer as several accounts matters to every account level report is pattern 06 of the Sales Cloud audit, with the quick sort by name that shows whether you have it. This article is the next step: why the rule that was meant to stop it did not.

Check your own org

Four queries before you change any rule.

Run them in the Developer Console query editor. The first two show every matching rule and duplicate rule with its status, and an Activating status can explain a test that found nothing. The third lists account phones not written in international format. The fourth counts the duplicate sets each rule has recorded so far.

SELECT DeveloperName, SobjectType, RuleStatus FROM MatchingRule SELECT DeveloperName, SobjectType, IsActive FROM DuplicateRule SELECT Phone FROM Account WHERE Phone != null AND (NOT Phone LIKE '+%') LIMIT 200 SELECT DuplicateRule.DeveloperName, COUNT(Id) FROM DuplicateRecordSet GROUP BY DuplicateRule.DeveloperName

Both rule objects need the View Setup and Configuration permission, and duplicate record sets can be read only once duplicate rules are active. If the third query returns a page of numbers starting with a bracket, a space or a domestic 0 or 8, fix the phones before touching the rule.

The phone fix

How do you make phone numbers match across formats?

Store them in one format. A before save flow on account, contact and lead strips spaces, brackets, dots and dashes, turns a leading 00 into a plus sign, and rewrites the domestic trunk prefix into the country code. Once every number is written the same way, an exact match on phone finds what a fuzzy one missed.

Trailhead’s unit on duplicate management shows fuzzy phone matching treating two numbers as one when only one carries a country code. In the build below the harder case was a domestic trunk prefix: the same mobile written with the domestic trunk prefix at home and with the country code from abroad. Numbers written the domestic way never reached the match threshold, so the fix went into the data, not the rule.

The rewrite has rules of its own. A number that starts with the trunk prefix gets the country code in its place; one that already starts with the country code gets the plus sign. A field holding several numbers, separated by a comma, semicolon or slash, is left as it is rather than guessed at. And nobody simply adds a country code to every number, because a customer abroad would get the wrong one. If your data mixes 07700 900123 with +44 7700 900123, run the same test before you trust the rule.

Block or warn

Should a Salesforce duplicate rule block or only warn?

Warn on fuzzy matches and enforce keys. A fuzzy name match is a guess, and a guess that blocks stops a rep saving a different company. A registration number or tax ID is a fact: make it a unique field, not a rule. A warning is not harmless to an integration either, because the API does not save the record until the code says it may.

The Metadata API Developer Guide, DuplicateRule, spells out the API side: with Allow and the alert on, the API returns an error code and a message on insert and a message on update, and to complete the save the code must set allowSave in the DuplicateRuleHeader and send the record again. A nightly import written without that header fails on every record a person would merely have been warned about.

One more case catches people. A flow that creates a record and relies on its fault path to catch the duplicate block still sent the administrator a flow error email in the build below, although nothing broke. Checking for the duplicate with Get Records and a decision before the create keeps both the record and the inbox clean.

One build, from the inside

Duplicates in a group that sells in several countries.

An industrial services group, a holding and its operating companies in several countries, customers typed in more than one alphabet and phones in every format a sales team can produce. This is the duplicate part, in the order it was built; the rest is in the second Salesforce implementation case study.

  1. 01

    The standard rule saw nothing

    An identical copy of an existing customer was saved with no warning. The standard account rule leans on a postal address in a form the data did not have, so for these records it compared almost nothing.

  2. 02

    A key that is the same in any alphabet

    Names arrived in two alphabets, and the fuzzy company name match never compared one with the other. The registration number became the key: a unique field on customer and lead, its length checked against the rules of the customer’s country. The unique index holds it, not the matching rule.

  3. 03

    One matching rule for the soft cases

    Name by the company name method, or phone exactly, or website exactly, or street and city together. Joined by OR, because any one of them is a reason to look.

  4. 04

    Phones in one format before any comparison

    Three before save flows, on customer, contact and lead, rewrite every number into one international format. Only then could the customer rule compare phones exactly. On contacts the phone method compares the normalised number.

  5. 05

    Warn, and say why

    Every custom rule warns rather than blocks, and its alert text names the fields that matched, so a rep can tell a true duplicate from a sister company in seconds. Lead rules stay off: here a lead is a tender, and the same customer sending two tenders is normal.

  6. 06

    Imported duplicates flagged, not merged

    Migrated customers that looked alike were loaded with a flag and a group, not merged, because two similar names can be two legal entities with deals on each. The client merges from the list, knowing which is which.

Every rule was proven by a test before and after the change, on a copy that should be caught. The test after activation waited for the rule to read Active: in this build, a retest while it still read Activating found nothing, a false negative.

Asked often enough to answer here

Questions

  • Q

    How many matching rules can one object have?

    Trailhead puts it at up to five active matching rules per object and up to three matching rules in each duplicate rule. That is enough for one strict rule and one loose one per object, which is usually what works: a key that is certain and a warning that asks a person to look.

  • Q

    Does a new duplicate rule find duplicates that already exist?

    Not by itself. A duplicate rule acts when a record is created or edited, so pairs that already exist stay unflagged until somebody edits one. Duplicate Jobs scan existing accounts, contacts or leads against a matching rule. Salesforce Help lists them for Performance and Unlimited editions and says they are not in all orgs, so check yours. Where they are missing, count the pairs with a query first. Merging is separate work.

  • Q

    Should we merge duplicates during a migration?

    Flag them during the migration and merge after. Two similar names can be two legal entities with deals on each, and only the business knows which. A visible list of possible pairs is safer than a merge that quietly joins two companies and cannot be cleanly undone.

  • Q

    Can a new lead be checked against an existing contact?

    Yes. Salesforce’s Standard Lead Duplicate Rule matches leads that duplicate other leads and contacts that duplicate leads, using the Standard Lead Matching Rule and the Standard Contact Matching Rule. In a custom rule the Metadata API takes the other object as matchRuleSObjectType, with a field mapping between the two. The fields compared must be filled in the same format on both.

The data quality check measures one customer read as three, accounts sharing a web domain with at least one other account, alongside three other measures, read only against your own data, delivered within three working days, and credited in full against any engagement booked within sixty days of delivery.

Serhii Skrypnyk · Senior Salesforce Administrator · 7 Salesforce certifications · on the platform since 2018. Reviewed 16 November 2026.

Read next

  1. 01

    Salesforce Lead Management: Seven Layers

    Seven layers where leads are lost between a form and a closed deal, what breaks in each, and why fixing the scoring model does not fix the handoff to sales.

  2. 02

    Pardot Form Handlers: Five Silent Failures

    Five ways Pardot form handlers drop leads without raising an error, and the thirty minute self audit that finds all five in your own org before you hire anybody.

  3. 03

    Sales Cloud Audit: Eight Checks, €650 Day

    A Sales Cloud audit in eight checks your admin can run, or a €650 data quality check in one day against your exports, €4,875 to fix all eight.