You need to sign in to do that
Don't have an account?
sudhirn@merunetworks.com
Disable trigger during data loader mass update
Hi,
Do we have any option to disable trigger during data loader mass update? Please suggest me if we have any options to disable.
Thanks
Sudhir
Do we have any option to disable trigger during data loader mass update? Please suggest me if we have any options to disable.
Thanks
Sudhir
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.
Thanks,
Sumit kumar Singh
No, You cannot deactivate the trigger directly in production.
How do I disable a Trigger in a production environment?
https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US
https://help.salesforce.com/apex/HTViewSolution?id=000006188
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:
Please let us know if this will help you
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;
}
else{
bypaas;
}
By following the above process, you will be able to migrate data bypassing the Trigger.
Hope this will solve you problem.
Thanks,
Gaurav
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.
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
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?