Loading

Limitations of Merging Converted Leads in apex

Publish Date: Feb 6, 2026
Description

Issue:

While trying to merge two Lead records in Apex, you may encounter unexpected behavior or errors when one or more of the leads are already converted. Specifically, attempts to use a converted Lead as the primary record in the Database.merge() method will fail or be blocked.

Applies To:

  • Salesforce Apex Development
  • Salesforce Lead Management
  • Developers and Admins using Database.merge()
Resolution

Root Cause:

Salesforce imposes a platform-level restriction on converted Leads:

  • Converted Leads are read-only in Apex, even in Lightning Experience.
  • Because of this restriction, converted Leads cannot be used as the master (primary) record in a merge operation.

On the other hand:

  • Unconverted Leads are editable, as they have not yet been tied to downstream objects like Account, Contact, or Opportunity.
  • Therefore, merging a converted Lead into an unconverted Lead (with the unconverted one as the master) is allowed.

 

Recommendation:

When performing lead merges in Apex:

  • Always ensure the primary/master Lead is unconverted.
  • Do not attempt to use a converted Lead as the target of the merge.
Knowledge Article Number

005123891

 
Loading
Salesforce Help | Article