+ Start a Discussion

Save child delete on Merge

Hi Guys,


I have a unique problem here, my issue is


1) I have a child object on Account with Lookup relationship. I have a OnDelete trigger on Account, so when the Account is deleted the child gets deleted, so far good.

2) But when the Account is "Merged", in this case too the child record gets deleted and the merging of the records is incorrect.


I would like to able to differentiate, if the deletion of the Account is whether via 'merge' request or if specifically called.


I would then like to bypass it in the on delete trigger. I found a field MasterRecordId on account, but not sure, if it gets set on the Loser/deleted account.


Please advise.




Jia HuJia Hu