Sub topic 1
How Duplicate Management works
Prerequisites
This chapter assumes you know the basic Salesforce data model (objects, fields and records). You should also be able to find your way around Setup as an administrator and know what Accounts, Contacts and Leads are. No Apex is needed here. Later developer chapters cover it.
The two building blocks
Duplicate Management is built from two kinds of rules that work as a pair.
- A matching rule decides whether two records are alike. It compares fields, such as name and email, and says "match" or "no match".
- A duplicate rule decides what happens when a match is found. It runs a matching rule when a user or an integration creates or edits a record, then takes an action.
A matching rule never stops a save by itself. A duplicate rule never compares fields by itself. Each duplicate rule points to one or more matching rules and relies on them for the comparison.
What happens on a save
The flow below shows how the two rules cooperate when a record is saved.
Three points about this flow matter in practice:
- The check runs on create and edit. You choose which of the two for each rule.
- The duplicate rule chooses the action. Each rule has separate actions for create and edit. Later chapters cover them in detail.
- Existing duplicates are not removed. Duplicate Management only flags or blocks them. Cleaning up is a separate step that uses merging.
Where the pieces live
Salesforce ships standard matching rules and standard duplicate rules for Accounts, Contacts and Leads. Some are active by default and some are not, so check Setup before you assume protection is on. You can also build custom versions of both.
| Piece | Setup page | Job |
|---|---|---|
| Matching rule | Matching Rules | Compares fields and decides if two records match |
| Duplicate rule | Duplicate Rules | Runs matching rules and chooses what happens |
| Duplicate record set | Created automatically | Groups records that were found to be duplicates |
Common misunderstandings
- Activating only the matching rule. A matching rule must be active, but it does nothing for users until a duplicate rule uses it.
- Expecting a search of the whole org. A duplicate rule can be limited. Sharing settings and conditions can narrow which records it compares, so a match may be missed. A later chapter covers this.
- Assuming a block is absolute. An Allow action with an alert lets users save anyway after acknowledging the alert. Only the Block action stops the save.
Exercise
A matching rule for Contacts is active, but users can still save obvious duplicate Contacts without any warning. What is the most likely cause?
Show answer
No active duplicate rule uses that matching rule. The matching rule only defines what counts as a match. A duplicate rule must reference it and have an action for create or edit, such as Alert or Block, before users see anything.