/StopTriggerHandler.cls Secret
Created
September 7, 2022 07:10
Star
You must be signed in to star a gist
StopTriggerHandler
This file contains 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
/*********************************************************************************** | |
Class Name : StopTriggerHandler | |
Description : This class can be used in the PB, flow to do the actions defined in the methods. | |
Created By : SFDC Lessons | |
Created Date : 09/06/2022 | |
Modification Logs: | |
------------------------------------------------------------------------------------ | |
Developer Date Descriptions | |
------------------------------------------------------------------------------------- | |
Arun Kumar 09/06/2022 Initial version | |
*************************************************************************************/ | |
public class StopTriggerHandler { | |
/** | |
* @description stopTrigger method can be called from PB/FLOWs to stop the object trigger for a transaction. | |
* @param triggerNameToStop | |
*/ | |
@InvocableMethod(label='Stop sObject Trigger' description='Stop the sObject trigger for this transaction') | |
Public static void stopTrigger(List<List<String>> triggerNameToStop){ | |
for(String varTrggrName: triggerNameToStop[0]){ | |
//switch statement checking trigger name and stoping the triggers | |
switch on varTrggrName { | |
when 'Account' { | |
TriggerSwitchCls.stopAccccountTrigger(); | |
} | |
when 'Opportunity' { | |
TriggerSwitchCls.stopOpportunityTrigger(); | |
} | |
when 'Contact' { | |
TriggerSwitchCls.stopContactTrigger(); | |
} | |
when 'OpportunityLineItem' { | |
TriggerSwitchCls.stopOLITrigger(); | |
} | |
when 'User' { | |
TriggerSwitchCls.stopUserTrigger(); | |
} | |
when 'Lead' { | |
TriggerSwitchCls.stopLeadTrigger(); | |
} | |
}//switch statement block ends here | |
}//for loop ends here | |
system.debug('Can Opportnity Trigger Execute ? : ' + TriggerSwitchCls.canAccountTriggerExecute()); | |
}//mehod ends here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment