User:Danielharotrade
Appearance
FFLIB Cliff Notes: Trigger Implementations:
public virtual void onBeforeInsert() { } public virtual void onBeforeUpdate(Map<Id,SObject> existingRecords) { } public virtual void onBeforeDelete() { } public virtual void onAfterInsert() { } public virtual void onAfterUpdate(Map<Id,SObject> existingRecords) { } public virtual void onAfterDelete() { } public virtual void onAfterUndelete() { }
//Handlers
public virtual void handleBeforeInsert() public virtual void handleBeforeUpdate(Map<Id,SObject> existingRecords) public virtual void handleBeforeDelete() public virtual void handleAfterInsert() public virtual void handleAfterUpdate(Map<Id,SObject> existingRecords) public virtual void handleAfterDelete() public virtual void handleAfterUndelete()
Trigger Imp:
Domain class: use Implementation tag example: public override void onBeforeInsert() {OpportunitiesService.handleBeforeInsert(Records); }
Service Class: Create Handler
[edit]public static void handleBeforeInsert(List<SObject> records) {
[edit]
triggerService(records).handleBeforeInsert();
[edit]}
[edit]
Implementation class:
[edit]public override void onBeforeInsert(List<SObject> records) {
//business logic goes here
}