For Apex triggers, the before and after contexts for insert and update operations makes sense in that the records can be modified during before and not during after.

In the case of delete operations, what exactly is different between before delete and after delete? In other words, if I'm designing a trigger to run when records are deleted, what information should I take into consideration when choosing to attach the trigger to before delete or to after delete?

2 Answers 2


The main difference is that you can't query the deleted records, or related child records in an after delete trigger. Child records will either be deleted, or have their lookup fields set to null, depending on the field's settings.


On the after delete you can block the deletion. On the before delete you can perform other cascading deletes, for instance.

  • 1
    This answer isn't right... You can block deletes in an after trigger, and cascade deletes typically need to be done in a before trigger, otherwise you can't query the child records.
    – sfdcfox
    Dec 13, 2019 at 22:48
  • Thanks for the heads up sfdcfox, always comprehensive knowledge sharing, will amend the answer just to avoid confusion. I wonder how would be possible to block delete on after delete trigger but will need some testing on my end. Dec 13, 2019 at 22:57

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.