0

I have a requirement to merge different accounts in Salesforce. When record B is merged with record A, record B will be deleted and will be merged into A.

Is there any possiblity of storing the values of record B in record A so that we can have track of it. I knew that in Account history related list, we can have track of it but I need it as a field to store both master record's and merged record's field values.

Also, is there any possibility of storing related lists of record B (merged record) as they will be deleted once the record is merged.

*************Update****************

Below is the trigger which creates a record with details of deleted account.

trigger AccountMergeTrigger on Account (after delete) {
    List<Merged_Account__c> listAccountBackup = new List<Merged_Account__c>();
    for(Account acct : trigger.old) {
        if(String.isNotBlank(acct.MasterRecordId)) { 
            listAccountBackup.add(new Merged_Account__c(Name = acct.Name, Policy_Number__c = acct.Policy_Number__c));  
        }         
    }
    if(listAccountBackup.size() > 0) {
        insert listAccountBackup;
    }    
}

Is there any way i can add parent account id so that this record will be associated with parent account in the related list. We can have a field called "merged with" and store the parent record name in that.

Please suggest

2 Answers 2

1

Is there any possiblity of storing the values of record B in record A so that we can have track of it. I knew that in Account history related list, we can have track of it but I need it as a field to store both master record's and merged record's field values.

This is not a built-in function. You would need to create custom code (an after delete trigger) to create this functionality.

Also, is there any possibility of storing related lists of record B (merged record) as they will be deleted once the record is merged.

Child records of merged objects are reparented to the winning record.

1
  • Please find the updated question above.
    – Skumar
    Apr 25, 2020 at 14:14
0

I would recommend using the Soft Delete Expert app (free) for this:

https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000DrynUUAR

It handles this problem by creating a merge log task on the surviving merged record (A) that details all the fields and values of the deleted record (B). Of course, you have to have Merge Logs enabled in the app settings.

As previously mentioned, child records all survive merges and are stored together on the surviving record.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .