I have few batch process to extract data. When I run them it hits the DML limit from a trigger. How can I exclude that trigger running when I run the batch

  • Is that Salesforce batch process? Do you extract data from one object, process and write into another object? Is that where dml is coming into picture? – realfire Sep 11 '17 at 23:39
  • It extracts from few objects with a process and update object as well. The update process hits the DML limit. – Jay Weera Sep 12 '17 at 0:08
  • Are you sure the trigger can be skipped for those updates? Have you looked at adjusting the scope parameter – David Cheng Sep 12 '17 at 0:11
  • As a admin I can run disabling the trigger. But I want end users to run it. thanks – Jay Weera Sep 12 '17 at 0:28

If you can disable the triggers from trigger edit page, you don't have to do anything special. However, this would disable triggers for all mutations.

If you want to disable trigger during this batch process, you can think about creating Apex Class with static flag. Set that flag inside that batch process and clear the flag at the end of it.

Inside the trigger, check for that flag and if so, skip processing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.