The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

How the merge() API handles Lead records and their MCAE Prospects (opens in a new tab)

You will learn which fields, history, related records and dates survive when Leads are merged, and how the linked MCAE Prospect behaves.

Why read this

You will also see how to find merged records afterwards with queryAll().

  1. Keep the chosen master Lead
  2. Reparent related records to it
  3. Copy the field values you supply
  4. Delete victims and set MasterRecordId
What the merge() call does to the victim Leads

The merge() SOAP API combines up to three records of the same type into one. The caller chooses the master record and the victims, and Salesforce keeps the master, reparents related records from the victims, deletes the victims and sets MasterRecordId on them. Field values are not copied automatically; any value the caller wants from a victim must be supplied on the master record in the MergeRequest.

For a merged Lead, the victims’ lead history is not carried over, but the surviving Lead gets a new “Lead Merged” history line showing the victim’s original name and company. Created By and Created Date are taken from the oldest victim. Related records such as Tasks, Campaign Members and Messaging Sessions move to the surviving Lead.

When both Leads are linked to MCAE Prospects, the Prospects are merged too and attached to the surviving Lead. The surviving Prospect keeps its original created date, but its conversion date and Recent Interaction date come from the oldest victim, and its audit log includes the victims’ activity. The article also notes an audit line reading “Started matching Marketing Data Sharing criteria”. Use queryAll() with MasterRecordId to find the records a merge deleted.

Read the original at SimplySfdc (opens in a new tab)

Worth reading?