Created
August 26, 2016 17:02
-
-
Save tauno/40ed6e4fbe1c286f98aebf7876bad935 to your computer and use it in GitHub Desktop.
Simple merge log Trigger for Salesforce Contacts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger ContactMergeTrigger on Contact (after delete) { | |
List<Merged_Contact__c> listMergedContacts = new List<Merged_Contact__c>(); | |
for(Contact contact : trigger.old) { | |
if(String.isNotBlank(contact.MasterRecordId)) { | |
listMergedContacts.add(new Merged_Contact__c(Contact__c = contact.MasterRecordId, Old_Contact__c = contact.id)); | |
} | |
} | |
if(listMergedContacts.size() > 0) { | |
insert listMergedContacts; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment