Posted By

d3developer on 08/06/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

esseff99


@dlog Trigger Template


 / Published in: Other
 

  1. trigger AccountTrigger on Account (after delete, after insert, after undelete,
  2. after update, before delete, before insert, before update) {
  3. AccountTriggerHandler handler = new AccountTriggerHandler(Trigger.isExecuting, Trigger.size);
  4.  
  5. if(Trigger.isInsert && Trigger.isBefore){
  6. handler.OnBeforeInsert(Trigger.new);
  7. }
  8. else if(Trigger.isInsert && Trigger.isAfter){
  9. handler.OnAfterInsert(Trigger.new);
  10. AccountTriggerHandler.OnAfterInsertAsync(Trigger.newMap.keySet());
  11. }
  12.  
  13. else if(Trigger.isUpdate && Trigger.isBefore){
  14. handler.OnBeforeUpdate(Trigger.old, Trigger.new, Trigger.newMap);
  15. }
  16. else if(Trigger.isUpdate && Trigger.isAfter){
  17. handler.OnAfterUpdate(Trigger.old, Trigger.new, Trigger.newMap);
  18. AccountTriggerHandler.OnAfterUpdateAsync(Trigger.newMap.keySet());
  19. }
  20.  
  21. else if(Trigger.isDelete && Trigger.isBefore){
  22. handler.OnBeforeDelete(Trigger.old, Trigger.oldMap);
  23. }
  24. else if(Trigger.isDelete && Trigger.isAfter){
  25. handler.OnAfterDelete(Trigger.old, Trigger.oldMap);
  26. AccountTriggerHandler.OnAfterDeleteAsync(Trigger.oldMap.keySet());
  27. }
  28.  
  29. else if(Trigger.isUnDelete){
  30. handler.OnUndelete(Trigger.new);
  31. }
  32. }
  33.  

Report this snippet  

You need to login to post a comment.