Sub topic 10
Matching across objects, such as Leads against Contacts
This chapter assumes you know how a duplicate rule calls a matching rule, and the difference between exact and fuzzy matching. It also assumes you have seen the Duplicate Rules page in Setup.
Why compare across objects
Duplicates are not always the same object. A sales rep may create a Lead for someone who is already a Contact. The two records describe one person, but a rule that compares Leads only to Leads will not catch it.
A duplicate rule can compare the record being saved with records of another object. The usual pairing is Lead against Contact, so reps see existing customers before they create new prospects.
How a cross-object rule works
A duplicate rule is attached to one object, called the source object. In the rule's matching rules section, you add one or more matching rules. Each matching rule belongs to an object you want to compare against, called the target object.
For a Lead duplicate rule, you might add two matching rules:
- A Lead matching rule, to compare the new Lead with existing Leads.
- A Contact matching rule, to compare the new Lead with existing Contacts.
Field mapping
Lead and Contact fields have different API names and sometimes different types. For the comparison to work, Salesforce needs to know which source field corresponds to which target field. For a cross-object matching rule, you set this up in the field mapping. For example, Lead Email maps to Contact Email, and Lead Last Name maps to Contact Last Name.
Standard matching rules for Leads and Contacts already include mappings between the two objects. If you build a custom matching rule and want to use it across objects, you must define the mapping yourself. A field that is not mapped is not compared.
What the user sees
With an alert action, the warning lists the matching records. These can be Contacts as well as Leads. The user can open a match before deciding whether to save.
With a block action, the save fails when any matching rule in the duplicate rule finds a match. Think about whether blocking is right here. Blocking a Lead because a Contact exists may stop legitimate work, such as a new opportunity at an existing customer. Many teams use alert for cross-object comparisons and keep block for same-object checks.
Common errors
- No matches appear. The target object's matching rule is missing from the duplicate rule, or its fields are not mapped.
- Matches are too loose. A fuzzy Contact rule with few conditions pulls in unrelated people. Add a stricter field condition, such as Email.
- Matches are hidden. Record-level security still applies. The user only sees matches they can access, so a rep may miss a Contact they cannot see.
Exercise
A Lead duplicate rule has only a Lead matching rule. Reps keep creating Leads for people who are already Contacts. What do you change?
Show answer
Edit the Lead duplicate rule and add a matching rule for the Contact object, such as the standard Contact matching rule, and confirm the Lead-to-Contact field mapping. Consider using an alert action so reps can review the Contact without being blocked.