Sitemap

Member-only story

About Salesforce MasterRecordId

What is MasterRecordId? Use of the MasterRecordId?

2 min readOct 31, 2019

When you try to use the Export All or query All operation using an API tool you could see a field MasterRecordId in the response, but when you try to access the field via the Object’s field list you may not find this because it’s not visible via the UI.

Why MasterRecordId?

When you try with exportAll and queryAll operations in Salesforce it will return the records with the combination of existing and deleted records of a particular object in Salesforce.

For example, if you are merging two records of Account object then one record will get delete and one will remain with the system. In this kind of scenario, Salesforce populates the MasterRecordId in the deleted record and fill the MasterRecordId with the id of the remaining record. This is why we see the MasterRecordId in the response.

Where we can use this?

When the user performs a record merge(Lead, Account, and Contact).

How?

Deletion of losing records

A single merge operation will fire a single delete event for all records that are deleted in the merge.

To determine which records were deleted as a result of a merge operation use the MasterRecordId field in Trigger.old.

--

--

Hariprasath Thanarajah
Hariprasath Thanarajah

Written by Hariprasath Thanarajah

8+ yrs of experience in Software Development and became a certified Salesforce Developer to develop end-to-end Salesforce features in Salesforce platform.

Responses (1)