You need to sign in to do that
Don't have an account?
Anna Signor
Account trigger not firing when account owner changes
I have am writing a trigger on Account that is supposed to fire when the Account Owner is changed. I tested the logic using classes and everything is doing its job, except the trigger is simply not firing. I then changed it to be triggered by different fields and it works just fine in those cases. I read something about Account Change Owner wizard operations not initiating process flows, is that true for triggers as well? What are my alternatives here?
Not firing:
Not firing:
trigger AccountTrigger on Account (after update) { System.debug('Account Team Trigger fired'); for(Id acctId: Trigger.newMap.keySet()){ if(Trigger.oldMap.get(acctId).OwnerId!= Trigger.newMap.get(acctId).OwnerId){ classes.dostuff(); } } DML; }However, this one is firing, only when I edit from the edit page, which is not possible for Account Owner:
trigger AccountTrigger on Account (after update) { System.debug('Account Team Trigger fired'); for(Id acctId: Trigger.newMap.keySet()){ if(Trigger.oldMap.get(acctId).otherField__c!= Trigger.newMap.get(acctId).otherField__c){ classes.dostuff(); } } DML; }
MQ
oldAcc = Trigger.oldMap
With that being said, your iteration looks simpler so I will change it. Thank you!