You need to sign in to do that
Don't have an account?

merge account
Hi ,
my requirement is to merge account records with same name . after merge i will store the deleted record value in another object . the deleted record which will store in new object will have the id of the master record of account to which it is merged .
my requirement is to merge account records with same name . after merge i will store the deleted record value in another object . the deleted record which will store in new object will have the id of the master record of account to which it is merged .
In the below trigger, when accounts are merged, then deleted record's Name and Website will be stored in Account Backup custom object.
Sample Trigger:
trigger AccountMergeTrigger on Account (after delete) {
List<Account_Backup__c> listAccountBackup = new List<Account_Backup__c>();
for(Account acct : trigger.old) {
if(String.isNotBlank(acct.MasterRecordId)) {
listAccountBackup.add(new Account_Backup__c(Name = acct.Name, Website__c = acct.Website));
}
}
if(listAccountBackup.size() > 0) {
insert listAccountBackup;
}
}
http://www.infallibletechie.com/2014/08/merge-trigger-example-in-salesforce.html
Please mark this as Best Answer if it helps you!