When records are merged in Salesforce you choose a record to be used as the Master version of that record, and that Salesforce ID will be preserved. You can choose to populate this record with values from the other duplicates before those duplicate records are deleted.
However, if you accidentally choose the wrong version of the duplicate records as the Master you may want to restore the other version of the record that was deleted.
This doc will walk you through an example of a record merge, which was made in error and needs to be reversed. We will be using Gearsets' Backup solution to do this.
I have 3 records, all of them for the contact Andy Young.
One of them has the additional pieces of information Other Phone and Home Phone.
All of these records have been backed up by Gearset.
I’m going to merge these records and let the backup run again.
However, during this process, the Master version of the record I choose to keep is not the one with additional information.
I now need a method to restore the version of the Andy Young record which has the Home Phone and Other Phone information on it.
Happily, because all of this data was backed up by Gearset I have a record of what I’ve just done, as well as a method to get the other version of this record back into my organization.
Now all I need to do is select the version of the record with the Home Phone and Other Phone value populated. I filter for the value ‘HomePhone is not empty’ to find the record I need.
Then I select that record and start the restoration config process.
If you attempt to deploy the record as-is then you will see the following error message - Salesforce is attempting to prevent you from creating a duplicate record.
There is further information about this error here.
To get around this there are 2 possible solutions.
Delete the Master record in the org that you kept in error as a result of the merge.
Temporarily disable the orgs duplicate rules.
We would recommend option 1, to avoid affecting any data input going on in other parts of the organization.
After the data restore has been completed, check your org. You should find that the record has been restored, and reparented.