• Abdul Aziz Khatri
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
We are currently working on the requirement of using contact merge process. During the salesforce contact merge process, the system first deletes the duplicate contacts and then repoints the related records to the master contact that is to remain. As per the link below, the MasterRecordId is only available after the delete happens and after delete trigger.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_merge_statements.htm

We have a before delete trigger in our org that checks to see if a contact has related records as well as other conditions and based on that information, it allows the contact to be deleted or stops a user from deleting the contact. Our before trigger as it is currently written, stops the merge process. We are so far unable to find a way to identify within the transaction that the delete is occurring due to a merge so that we can handle merge process within the trigger. We are looking to see if someone might help with this tricky issue? We haven’t been able to identify something in the documentation of the merge process that will help us rewrite the trigger code.
We are currently working on the requirement of using contact merge process. During the salesforce contact merge process, the system first deletes the duplicate contacts and then repoints the related records to the master contact that is to remain. As per the link below, the MasterRecordId is only available after the delete happens and after delete trigger.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_merge_statements.htm

We have a before delete trigger in our org that checks to see if a contact has related records as well as other conditions and based on that information, it allows the contact to be deleted or stops a user from deleting the contact. Our before trigger as it is currently written, stops the merge process. We are so far unable to find a way to identify within the transaction that the delete is occurring due to a merge so that we can handle merge process within the trigger. We are looking to see if someone might help with this tricky issue? We haven’t been able to identify something in the documentation of the merge process that will help us rewrite the trigger code.