Salesforce offers a few options to merge records, whether they be accounts or contacts.

The merging process is straightforward for the user; you choose which record becomes the master, and merge individual fields into the master. All related objects of the merged records are reparented, and then merged records are deleted.

Cool, but is that all?

Being a senior Salesforce consultant, you need to consider the bigger picture. And the bigger picture may include external systems that integrate with the objects you just merged. So verify whether any other systems are impacted by merges.

If there are none, great, your job is done.

If there is one or more, you need to understand the technical steps of the merge process so you can update those systems as needed.

In brief, the merge fires a delete event for all records that will be deleted (the ones that will not remain). When a record is being deleted, its MasterRecordId field is set to the Id of the master record (the one that remains) right before being deleted. This update allows you to know which record was merged to which record.

The update to the MasterRecordId can only be caught in after-delete events, so use apex or flows to trigger functionality to update the external system as needed.

The takeaway
When Salesforce implementations are large, they tend to have integrations to other systems. You need to consider the bigger picture and constantly determine what the impacts are to those systems. Something as simple as a merge may be simple in Salesforce, but may have a ripple effect across multiple external systems.

Bonus: Now you know what the field MasterRecordId actually does!

Category:
Salesforce