-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccountTrigger.cls
37 lines (33 loc) · 1.31 KB
/
AccountTrigger.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
trigger AccountTrigger on Account (after delete,
after insert,
after undelete,
after update,
before delete,
before insert,
before update) {
AccountTriggerHandler handler = new AccountTriggerHandler(Trigger.isExecuting, Trigger.size);
if(Trigger.isInsert && Trigger.isBefore){
handler.OnBeforeInsert(Trigger.new);
}
else if(Trigger.isInsert && Trigger.isAfter){
handler.OnAfterInsert(Trigger.new);
AccountTriggerHandler.OnAfterInsertAsync(Trigger.newMap.keySet());
}
else if(Trigger.isUpdate && Trigger.isBefore){
handler.OnBeforeUpdate(Trigger.old, Trigger.new, Trigger.newMap);
}
else if(Trigger.isUpdate && Trigger.isAfter){
handler.OnAfterUpdate(Trigger.old, Trigger.new, Trigger.newMap);
AccountTriggerHandler.OnAfterUpdateAsync(Trigger.newMap.keySet());
}
else if(Trigger.isDelete && Trigger.isBefore){
handler.OnBeforeDelete(Trigger.old, Trigger.oldMap);
}
else if(Trigger.isDelete && Trigger.isAfter){
handler.OnAfterDelete(Trigger.old, Trigger.oldMap);
AccountTriggerHandler.OnAfterDeleteAsync(Trigger.oldMap.keySet());
}
else if(Trigger.isUnDelete){
handler.OnUndelete(Trigger.new);
}
}