function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion 

Disable trigger during data loader mass update


  Do we have any option to disable trigger during data loader mass update? Please suggest me if we have any options to disable. 

Sumit Kumar Singh 9Sumit Kumar Singh 9
I don't think that you can deactivate the trigger directly in the production.

1) You will have to redeploy the trigger as inactive. Once the data loading is finished, again deploy it as active.
2) If you requirement is to disable the trigger frequently, better to have a custom setting, based on the value of custom setting value you can toogle it.

Sumit kumar Singh
Amit Chaudhary 8Amit Chaudhary 8
Hi Sudir,

No, You cannot deactivate the trigger directly in production.

How do I disable a Trigger in a production environment?

Important: You must consider the consequences of disabling a trigger in the production environment during work hours. It is highly recommended to perform this work outside normal business hours and to disable access to the application to non administrators during the maintenance period.

Follow these steps:
  • Disable the trigger on the sandbox environment
  • Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
  • Alternative: edit the triggername.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
  • Save the change locally
  • Deploy the trigger to production
  • Complete the data load
  • If the change is not permanent or you want to enable the trigger again then enable the trigger by making it active on the sandbox or project again and deploy it to production

Please let us know if this will help you
Thanks for your reply my requirement is not to disable the trigger I dont want trigger to fire during data loader mass update. Is there any alternativy approch to do this activity not to fire the trigger while mass update. 

Hi Sudhir,

Your requirement is clear and can be easily implement.
As far, I am understanding. The requirement is to fire trigger incase of record update, but do not want to update record in-case of mass update i.e. bulk update via data loader. 
1. Create a custom profile having all modify all access on all custom standard object. 
2. The profile should in salesforce licence. 
3. The profile can be named se "Integration"
4. Create a user 'Data Integration' and assign "Integration" profile.
5. Now login via user and reset its Security token.
Once this is setup.

1. You to need to add a check in trigger for profile or user. 
if(UserInfo.getLastName != 'Integration'){ 
  run trigger logic;

By following the above process, you will be able to migrate data bypassing the Trigger. 

Hope this will solve you problem.



Ok just fallen across this thread and needs a bit of an update as things have moved on since this question was answered.

Don't use profiles or embed code to say if the user's lastname is this then bypass etc... You can use a hierarchical custom setting. This means you can have a setting called "Bypass Triggers" and then you can set all users/roles etc to false and be very proscribed which users/roles have triggers disabled. Then in your triggers just add a simple check to see if the BypassTriggers custom setting is true and to not run the logic. The reason you should use a hierarchical custom setting is you then have a lot more control over who gets that permission and also it's slightly hidden away so that Admins etc can't just choose (eg) the "integration profile" and not realise that then those users are using the system without any triggers firing which could cause a potential crazy mess. Alternatively, you could use custom metadata types... OR If you want Admin control/visibility have a Permission Set called "Disable All Triggers" and use that to assign to users so its REALLY obvious that adding this permission set will disable triggers rather than an "Integration" Profile which doesn't actually tell you what potential adverse reaction you will happen in the org.
Arnab Sarkar 8Arnab Sarkar 8
It is not best approach to manually disbale-enable trigger. The best approach would be to use custom setting. Create a hierarchy custom setting, create a checkbox under that as a custom field. Default it should be true (checked). Before you load huge data in production set it as false (unchecked). In trigger logic please put all of your logic inside a if statment where we check if the checkbox is true

trigger abc on accout (after update) {
// Get the value of the checkboix field here
        if (dataload_runing) {
            //put all your code-logic here  

Once data loading is over please reset the check-box as true so that trigger code will execute as-is

If my answer/solution looks fine, please mark it as best-answer
Jaye LoweJaye Lowe
So, to follow up on this: if I have a custome setting called: Trigger Bypass and I created a checkbox field on this setting called Trigger Off and this box is checked. And I apples this by user. (Meaning that if I (JL) am mass updating records that the trigger should not run. 
How would I add this to the trigger and would I then have to add this to the corresponding test class and if so how?