+ Start a Discussion

how to stop Trigger execution ?

how to stop Trigger execution , when insert the records by using import wizard and data loader ?


ple tell me if u know .   thank u .



Dhaval PanchalDhaval Panchal

Just make trigger inactive.
Go to that trigger, Click on edit, there is one checkbox at leftside above the trigger editor "Is Active", just uncheck that checkbox and click on save. Trigger will be not fired untill you mark that check box again.


In case of production, you have to do same process at sandbox and then deploy that trigger to production.


Alternative approach can be, create new LABEL (like "ExecuteTrigger "), set it as TRUE. Update your trigger with below template 



trigger TestTrigger on Account (after update) {
  if(System.Label.ExecuteTrigger == 'TRUE' ) {
      // your existing trigger code
  } else {
     System.debug('@@ Trigger is disable to migrate data.');


Now whenever you want to load data into SFDC, you just have to set LABEL value as "FALSE" and after migration activity you can enable your trigger back by changing label value as "TRUE".


This will be single time activity for you and rest just toggling LABEL value in production.


Please make sure that you are disabling the trigger when no user is using SFDC. Like mid-night or performing it on weekend. This will help you not to have invalid data in system.