0

I was going through the Trigger execution sequence .

for the following lines :

6.Saves the record to the database, but doesn't commit yet. 7.Executes all after triggers.

Do the After Triggers run when user hits SAVE button ? IF I am getting an error after hitting SAVE button , has after triggers been executed ?

1

yes after trigger always run when you update a record(There are some exception when trigger don't run).

But if you are getting some error then it depends because if you are getting exception in validation or in before triggers then in that case after trigger will not run.

So in short if you get error in before the after trigger execute, execution will stop and after trigger will not run.

Also any changes made to the database also revert back.

  • I am getting an Insufficient Privilege error upon saving a record . I could see an afterinsert trigger (in with sharing handler class )updating another object to which the user doesnot have access . So is it right to suspect that it's because the after INSERT trigger cannot access ? – SFDCRookie Sep 6 '16 at 11:27
  • 1
    @SFDCRookie Its not because after update trigger cannot access. its because user don't have access. Although if you use without sharing then maybe you can update. – Tushar Sharma Sep 6 '16 at 11:30
  • Yes that's what I meant . So on a new record , after insert runs once I hit the SAVE button , right? – SFDCRookie Sep 6 '16 at 11:33
  • @SFDCRookie yes it will run. – Tushar Sharma Sep 6 '16 at 11:43
  • Thank you . Another question . If there is a logic in place to query records and check and then update if it satisfies certain conditions, will it first check for permission even before executing logic ? – SFDCRookie Sep 6 '16 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.