How to Merge Contacts in Salesforce

Merge up to three duplicate contacts at a time, keep the right record, and avoid breaking the tools that point at it.

By Duplicate Contact Editors · Updated

The short answer

In Lightning Experience, open one of the duplicate contacts, click View Duplicates, select up to three contacts, choose the principal record and the field values to keep, then click Merge. In Salesforce Classic, use Merge Contacts on the account's Contacts related list. The other contacts are deleted, their related records move to the one you keep, and Salesforce warns that the merge can't be undone.

Before you merge: decide which record survives

Every merge keeps one contact, the principal (Salesforce Classic and the API call it the master record), and deletes the others. The principal keeps its Salesforce ID; the deleted contacts' IDs stop working. That makes the choice of principal more important than any single field value, because you can copy field values across on the compare screen but you can't move an ID.

Check these before you click anything:

  • Is it the same person? A matching name on the same account isn't proof. Compare email, phone and recent activity.
  • Which record do other systems point at? If HubSpot, a visitor identification tool, a marketing platform or a support desk stores a Salesforce contact ID, keep the contact those systems are synced to as the principal. For HubSpot, the HubSpot contact's Salesforce Contact ID property names it (and our guide to merging contacts in HubSpot covers the HubSpot side); see Deduping Visitor-ID Records Across HubSpot and Salesforce.
  • Owner and account. Both are fields on the compare screen. The owner decides who sees the contact and gets its tasks, so pick deliberately.
  • Opt-outs. If either record has Email Opt Out or Do Not Call set, keep that value on the principal.
  • A backup. Before a large clean-up, export the contacts with their IDs, so a wrong merge can be rebuilt by hand.

Merge contacts in Lightning Experience

Salesforce lists contact merging in Lightning Experience for Essentials, Professional, Enterprise, Performance, Unlimited and Developer Editions.

  1. Open one of the duplicate contacts.
  2. In the Potential Duplicates panel, click View Duplicates.
  3. Select the contacts to merge (up to three, including the one you're on) and click Next.
  4. On the compare screen, choose Use as principal on the record to keep, then pick the value to keep for each field that differs. Only differing fields are listed; use Show All Fields to see the rest.
  5. Click Next, read the confirmation, and click Merge.

In Lightning you can merge contacts that sit on different accounts, unless one of them is enabled as a portal or community user. The principal keeps its own account, so check you aren't merging two different people with the same name at different companies.

When View Duplicates doesn't appear

The Lightning merge starts from duplicates Salesforce has already found, so it depends on your duplicate management setup:

  • No active contact duplicate rule. The Potential Duplicates panel only lists records that an active duplicate rule's matching rule flags. Check Setup → Duplicate Management → Duplicate Rules.
  • The component isn't on the page. Custom Lightning record pages often leave out the Potential Duplicates component. Add it in Lightning App Builder.
  • The matching rule doesn't see a match. “We found no potential duplicates” means the rule compares fields your two records don't share, for example the standard contact rule won't pair two records with the same name if one has an email and the other only a phone number. Our guide to Salesforce duplicate rules and matching rules for visitor data covers which fields to match on.
  • Missing permissions. You need Delete on contacts (see permissions below).

Merge contacts in Salesforce Classic

  1. Open the account the duplicate contacts belong to.
  2. In the Contacts related list, click Merge Contacts.
  3. Search for the contacts if needed, select up to three and click Next.
  4. Choose the master record, select the value to keep for each field, and click Merge, then confirm.

Classic only offers contacts from the same account. If the Merge Contacts button is missing, the user lacks Delete on contacts or the button has been removed from the related list on the account page layout.

What happens to the merged contacts

After the merge
Principal contactKept, with its own ID and the field values you chose
Other contactsDeleted; each one's MasterRecordId points to the principal
Related recordsActivities, cases, opportunity contact roles, campaign memberships and other related items move to the principal
UndoNone from the merge screen: Salesforce warns that merging can't be undone

Merges don't fire their own Apex trigger events. Salesforce fires a delete event for the losing records (with MasterRecordId set in after delete triggers) and an update event for the principal, so automation that reacts to contact deletes will run on every merge. If you need to recover a contact merged by mistake, start from Salesforce's own help article on recovering merged contacts, listed under Sources.

Permissions you need

To mergePermissions
ContactsDelete on contacts
Customer Portal enabled contactsDelete on contacts, and Manage Customer Users or Edit Self-Service Users
Partner Portal enabled contactsDelete on contacts, and Manage External Users or Manage Partners

Users also need edit access to the records they merge. If someone reaches the compare screen and then hits an insufficient privileges error, check record access on every contact in the set, not just their profile.

Merging many duplicates at once

The standard merge handles three contacts at a time and there's no built-in “merge all” button. For a larger clean-up:

  • Duplicate jobs and duplicate record sets. A duplicate job scans existing records with a matching rule and groups what it finds into duplicate record sets you can review and merge. Duplicate jobs aren't in every edition; check Salesforce Help's duplicate jobs page for yours.
  • Apex or the API. The Apex merge statement and Database.merge(), and the SOAP API merge() call, merge up to three records of the same type (contacts, leads, accounts or cases). Unlike the compare screen, they don't choose field values for you: copy anything you want to keep onto the principal before the call.
  • AppExchange deduplication tools. These add rule-based mass merging. Compare their survivorship rules and pricing on each vendor's own listing.

Whichever route you take, set one rule for picking the principal (for example, the record your sync tools point at, then the one with the most recent activity) and log each merged pair, principal ID and merged ID, so you can trace changes later. Run it in a sandbox first.

Contacts created from website visitor data

Visitor identification tools and enrichment syncs usually write contacts through the API, and Salesforce's duplicate rules don't show alerts on API writes, so these contacts are a common source of duplicates. Merging them is the same process, with two extra checks:

  • Keep the ID the tool wrote to. If the visitor tool or HubSpot keeps writing to a contact ID you merged away, it may create a new contact on its next sync. Check the vendor's documentation for how it handles merged Salesforce records before a bulk clean-up.
  • Fix the source. Make the integration look up an existing contact by business email before it creates one, and tighten your matching rules, or the duplicates come back. See Why Your CRM Is Full of Ghost Contacts for the records you may want to delete rather than merge.

Frequently asked questions

How many contacts can I merge at once in Salesforce?

Up to three per merge, in Lightning, in Classic and through Apex or the API. For more, use duplicate record sets, a batch Apex job or an AppExchange tool.

Can I merge contacts from different accounts?

Yes in Lightning Experience and through Apex, unless one of the contacts is a portal or community user. Salesforce Classic's Merge Contacts button only works within one account.

Can I undo a contact merge?

Not from the merge itself: Salesforce warns that merging can't be undone. Export contacts with their IDs before a large clean-up, and see Salesforce's help article on recovering merged contacts.

Why is the View Duplicates button missing?

Usually because no active duplicate rule flags the records, the Potential Duplicates component isn't on the contact's Lightning record page, or you lack Delete on contacts.

What happens to activities and opportunities after a merge?

Related records such as activities, cases, opportunity contact roles and campaign memberships move to the principal contact.

Sources

  1. Merge Duplicate Contacts in Lightning Experience (Salesforce Help)
  2. Considerations for Merging Duplicate Contacts (Salesforce Help)
  3. Recover Merged Salesforce Contacts (Salesforce Help)
  4. Manage Duplicates Globally (Salesforce Help)
  5. Merging Records (Apex Developer Guide)
  6. Triggers and Merge Statements (Apex Developer Guide)
  7. merge() (SOAP API Developer Guide)

Read next