Sub topic 3
Standard matching rules and when they are enough
This chapter assumes you know how a matching rule and a duplicate rule fit together from the earlier chapters. You should also be comfortable with Accounts, Contacts and Leads, and with finding Duplicate Management in Setup. The goal is to decide whether the matching rules Salesforce ships are enough for your org, or whether you need a custom rule.
What standard matching rules are
A standard matching rule is a matching rule that Salesforce defines and maintains. Each rule targets one object and combines several fields into a single matching equation. Standard rules exist for Accounts, Contacts and Leads. If your org uses person accounts, there is also a standard rule for them.
Three properties set them apart from custom rules:
- You cannot edit them. You can view the fields and methods they use, but you cannot add, remove or reorder conditions.
- They are maintained by Salesforce. Salesforce can refine the matching logic between releases, so results may shift slightly over time without any change on your side.
- They are ready to use. You do not build anything. You select the rule when you create a duplicate rule.
Most standard rules combine fuzzy matching on names with exact or fuzzy matching on contact details such as email, phone and address. The Lead and Contact rules also use company or account information. Open the rule in Setup under Matching Rules to see the exact field list for your org. Do not rely on a list from memory, because Salesforce can change it.
How standard rules show up in a duplicate rule
You do not activate a standard matching rule on its own. You create a duplicate rule and pick the matching rule it should use. When you activate the duplicate rule, Salesforce activates the matching rule it depends on. Matching rules that are inactive or still building cannot be used by an active duplicate rule.
Activation can take some time while Salesforce indexes existing records. Until the status is Active, duplicate rules that depend on it will not behave as expected.
What "enough" means
A standard rule is enough when the business definition of a duplicate matches what the standard rule already detects. For many orgs that is the case for these scenarios:
- People records entered by hand. Sales reps create Leads and Contacts with typos in names, so fuzzy name matching combined with email or phone catches most repeats.
- Common B2B data. Accounts are usually the same company if the name, website, phone or billing address line up.
- A first rollout. You want to start catching obvious duplicates quickly and learn how your data behaves before investing in tuning.
- Low administrative capacity. Standard rules need no maintenance and no custom equation to debug.
If your team cannot name a specific false positive or false negative that the standard rule causes, there is little reason to replace it.
When standard rules are not enough
Standard rules cannot be changed, so some needs push you to a custom rule.
| Situation | Why the standard rule falls short | What to do |
|---|---|---|
| Custom fields define identity, such as an external ID or tax number | Standard rules only use a fixed set of standard fields | Build a custom matching rule on the custom field |
| Too many false positives | You cannot loosen or remove a condition | Create a stricter custom rule |
| Missed duplicates | You cannot add a field or switch a field to fuzzy | Create a custom rule with the fields and methods you need |
| Custom objects | Standard rules do not exist for custom objects | Use a custom matching rule |
| Different definitions per business unit | One standard rule means one definition | Use custom rules, with duplicate rule conditions to separate the units |
| Mostly blank key fields | Standard rules depend on the fields they are built on | Check how the rule handles blanks, or use a custom rule |
Trying a standard rule safely
A low-risk way to evaluate a standard rule is to run it in observation mode first.
- Create a duplicate rule on Contacts that uses the standard Contact matching rule.
- Set the actions on create and edit to Allow, with Report turned on and the alert turned off.
- Activate the rule and let users work normally for a few days.
- Review the duplicate record sets and the duplicate reports to see what the rule flagged.
- Look at both sides: flagged pairs that are not true duplicates, and known duplicates that were not flagged.
- Change the action to Alert or Block only when you trust the results.
This approach separates the question "does the matching work?" from "is the user experience acceptable?" Switching straight to Block can stop legitimate saves and generate support requests.
Checking behavior from Apex
You can test what a standard rule finds without saving anything. The call below uses whatever active duplicate rules exist for the object, so a duplicate rule on Contact that uses the standard matching rule must already be active.
Contact candidate = new Contact(
FirstName = 'Jon',
LastName = 'Smith',
Email = '[email protected]'
);
List<Datacloud.FindDuplicatesResult> results =
Datacloud.FindDuplicates.findDuplicates(new List<Contact>{ candidate });
for (Datacloud.FindDuplicatesResult findResult : results) {
for (Datacloud.DuplicateResult dupResult : findResult.getDuplicateResults()) {
System.debug('Duplicate rule: ' + dupResult.getDuplicateRule());
for (Datacloud.MatchResult matchResult : dupResult.getMatchResults()) {
System.debug('Matching rule: ' + matchResult.getRule());
for (Datacloud.MatchRecord matchRecord : matchResult.getMatchRecords()) {
System.debug('Possible duplicate: ' + matchRecord.getRecord());
}
}
}
}Run this in Execute Anonymous with the debug log open. Try variations such as a misspelled first name, a different email, or a missing email. Each variation shows you how strict the rule is without any fake records in your org.
Common problems
- The rule never fires. The duplicate rule is inactive, or the matching rule has not finished activating. Check the status of both.
- Fewer matches than expected. Key fields are blank on the saved record. Matching depends on the data that is present, so records with little data match poorly.
- Matches that surprise users. Fuzzy matching on names can link similar but different people. Review the matched fields before adjusting any action.
- Existing duplicates are not flagged. Duplicate rules act when records are created or edited. They do not scan old data for you. Existing duplicates only appear as duplicate record sets or in reports after a record is saved and matched, or when you use other tools.
- Users cannot see the match. Duplicate rules respect record visibility settings. If a user cannot see the matching record because of sharing, the rule may not report it to them. The chapter on sharing and rule conditions covers this.
Summary of the decision
Start with the standard rule when the object is Account, Contact or Lead (or person account) and your definition of "duplicate" is close to the usual one. Evaluate it with Allow and Report. Move to a custom rule only after you have evidence of a specific gap, or when the object or fields fall outside what standard rules cover.
Exercise
Your org tracks customers by a custom field named TaxID_c on Account. Users also complain that the standard Account rule flags too many unrelated companies. Should you keep the standard rule? Explain why or why not, and name one safe first step before changing any user-facing action.
Show answer
No. Standard rules cannot be edited, and they do not use custom fields such as TaxIDc, so you cannot tighten them or add the Tax ID condition. A custom matching rule on Account that matches exactly on TaxID__c (and possibly on other fields) is the right fix. A safe first step is to create a duplicate rule that uses the new matching rule with the actions set to Allow and Report only, then review the duplicate record sets before moving to Alert or Block.