function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Connor ReillyConnor Reilly 

Storing merged account details

Hi all, 

I'm looking for a way to store merged account details (ie. the account id merging from and to, and the account name merging from and to). The purpose of this to inform another database that is communicating with Salesforce via the api.
AnudeepAnudeep (Salesforce Developers) 
Hi Connor, 

As far as I know, you have to query for merged account details and store in the Account object 
 
SELECT MasterRecordId FROM Account
WHERE MasterRecordId != null
ALL ROWS

As per the documentation, If this object was deleted as the result of a merge, this field contains the ID of the record that was kept. If this object was deleted for any other reason or has not been deleted, the value is null.

Or you can build a trigger. I recommend taking a look at this example code

If you find this information helpful, please mark this answer as Best. It may help others in the community. Thank You!

Anudeep