Skip to content

Instantly share code, notes, and snippets.

@jamesasu
Created March 15, 2020 23:12
Show Gist options
  • Save jamesasu/f57eb7a74a207461855945dc202dd615 to your computer and use it in GitHub Desktop.
Save jamesasu/f57eb7a74a207461855945dc202dd615 to your computer and use it in GitHub Desktop.
global void finish(Database.BatchableContext BC){
enableTriggers();
}
global static void enableTriggers() {
toggleTriggers(true);
}
global static void disableTriggers() {
toggleTriggers(false);
}
global static void toggleTriggers(Boolean active) {
List<npsp__Trigger_Handler__c> handlers = npsp.TDTM_Config_API.getCachedRecords();
for (npsp__Trigger_Handler__c th : handlers) {
if (th.npsp__Object__c == 'Allocation__c' && th.npsp__Class__c == 'ALLO_Allocations_TDTM') {
th.npsp__Active__c = active;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment