Pages

Thursday, November 5, 2026

Salesforce: Lead merge with MCAE Prospect

Salesforce merge() SOAP API, allow to combine up to three records of the same type into one record. You explicitly tell Salesforce which record is the master/survivor and which record(s) are merged into it. Salesforce does not automatically decide that the newer or older record survives.

Let say you have Lead A, B, and C; you decide keep lead A as the master record (survivor) and merge lead B and C (victims) into lead A.

  • Keeps Lead A as the master record.
  • Merges Lead B/C into Lead A.
  • Deletes B/C as the "victim" records.
  • Reparents related records from the victims to Lead A where applicable
  • Sets MasterRecordId on the deleted victim records so you can identify what they were merged into.

Field Values

Salesforce doesn't automatically replace the master's fields with all the values from the victim. If the caller wants values from the non-master record to supersede values on the master, those field names and values must be supplied on the masterRecord in the MergeRequest.

Once the API run, you can do SOQL using queryAll() to retrieve records deleted by a merge, and MasterRecordId identifies merged records.


A few facts in the survived Lead:
  1. Lead history of victim leads will not be carried to the survived lead, so the lead history stay as per original
  2. Lead history have a new line of "Lead Merged" with original value of the victim lead name and company name
  3. Created By and Created Date is updated with the oldest victim lead
  4. All the related records (Task, Campaign Member, Messaging Session, etc.) from victim leads will be reparent to the survived lead


SOQL with queryAll():




What happened in the MCAE Prospect?
Assume both lead are in the prospect:
  • The prospect will be merged too and link to the survived lead
  • In the prospect audit, notice a line "Started matching Marketing Data Sharing criteria"
  • Created date in the survive prospect will stay as per original date, however, the conversion date and other date such as Recent Interaction will be copy from oldest victim
  • Prospect audit will have data from victim leads, including the old prospect activities


No comments:

Post a Comment

Page-level ad