I am trying to implement the Trigger Handler Framework as seen here: https://www.salesforceben.com/the-salesforce-trigger-handler-framework/. It uses the following model 'Helper + Interface + Handler + Trigger'. I have saved the Trigger, the Handler, the Interface, and Helper and am trying to update the Helper file in order to create a simple Before Update trigger on the Account object.
Account Trigger Helper class:
public without sharing class AccountTriggerHelper {
public AccountTriggerHelper() {
System.debug('Inside AccountTriggerHelper Constructor');
}
public void doTask1(List<Account> newAccounts) {
List<Account> accountList = new List<Account>();
for(Account acc : newAccounts){
acc.Phone = '222-222-2222';
accountList.add(acc);
}
UPDATE accountList;
System.debug('Inside Task 1');
}
Account Trigger Handler class:
public without sharing class AccountTriggerHandler implements TriggerHandler {
private boolean triggerIsExecuting;
private integer triggerSize;
public AccountTriggerHelper helper;
public AccountTriggerHandler(boolean triggerIsExecuting, integer triggerSize) {
this.triggerIsExecuting = triggerIsExecuting;
this.triggerSize = triggerSize;
this.helper = new AccountTriggerHelper();
}
public void beforeInsert(List<Account> newAccounts) {
helper.doTask1();
helper.doTask2();
}
However, I am getting the following error:
Method does not exist or incorrect signature: void doTask1() from the type AccountTriggerHelper