Please let me know if this should be deleted and/or merged with other topics (but literally every single google result I get is purple already - I have looked at everything I can find).
Long story very short, I need to update a merged record field (on the winner of the merge) to fire a flow. I have looked at after delete triggers for the losing record of the merge, but I don't think this is the way (please please correct if I'm wrong). I think I need to do an after update trigger on the winning record instead to update the winning record's field, that will then fire the flow.
I have an after delete trigger looking at losing records where MasterRecordID != null, but I'm having trouble updating the winning record (foreign key errors). I am open to any other suggestions if this sounds like a bad approach. Any help would be much appreciated.
Thanks.
EDIT:
trigger contactMergeUpdateWinner on Contact (after delete) {
for(Contact cont : Trigger.old){
if(cont.MasterRecordId != Null){
String winnerId = cont.MasterRecordId;
Contact contWinner = [SELECT Id, Launch_Flow__c FROM Contact WHERE Id =: winnerId];
contWinner.Launch_Flow__c = true;
update contWinner;
}
}
}
I am receiving "currently in a merge operation, therefore a trigger can not update it".
I know there is probably a super simple explanation for this. I'm googling everything I can, so I'm sure I'll come across the answer soon, but any help is much appreciated.