Open
Description
Often we come across scenarios when a bulk update or certain operation(s) are required to be done , while keep the trigger state as inactive.
To incorporate that I would like propose to add a new method : protected virtual boolean isTriggerEnabled() to the class.
The expectation is that this method is to be overridden by implementing object specific triggerHandler classes so that the developers can
put check on configurations (e.g. Custom Metadata / Custom Settings).
Also inside the run method we would require a small change like :
if( !validateRun() && isTriggerEnabled() ) {
return;
}
The expectation for the isTriggerEnabled() override is something as below :
public override Boolean isTriggerEnabled() {
Boolean returnedValue = false;
/****************************************************************************
Validate settings from Configuration like Custom metadata / Custom settings
For each custom object there needs to be a separate configuration record
****************************************************************************/
Custom_Trigger_Parameter__c trig = Custom_Trigger_Parameter__c.getInstance();
genesis__Org_Parameters__c orgParam = genesis__Org_Parameters__c.getInstance();
if(trig?.AppTrigger__c == False && orgParam?.genesis__Disable_Triggers__c == False){
returnedValue = true;
}
return returnedValue;
}
Metadata
Metadata
Assignees
Labels
No labels