Created
February 7, 2019 10:16
-
-
Save lfreeland/ef3338b8292a15dad41ddd432c5a31c8 to your computer and use it in GitHub Desktop.
Account Trigger Handler Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public with sharing class AccountTriggerHandler extends TriggerHandlerBase { | |
| protected override void beforeInsert(List<Sobject> newRecords) { | |
| List<Account> newAccounts = (List<Account>) newRecords; | |
| } | |
| protected override void beforeUpdate(Map<Id, Sobject> oldRecordsMap, Map<Id, Sobject> newRecordsMap) { | |
| Map<Id, Account> oldAccountsMap = (Map<Id, Account>) oldRecordsMap; | |
| Map<Id, Account> newAccountsMap = (Map<Id, Account>) newRecordsMap; | |
| // Do something with the Account records. | |
| // Use private methods in this class to handle the work or | |
| // delegate it to a service class. | |
| } | |
| // Use private methods to handle the heavy lifting | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment