Activity › Forums › Salesforce® Discussions › Does trigger run batches?
-
Does trigger run batches?
Posted by shariq on July 4, 2017 at 5:51 AMDoes trigger run batches?
Parul replied 7 years, 9 months ago 3 Members · 2 Replies -
2 Replies
-
Hello Shariq,
Triggers run in System context and you can’t control its execution in Batch context.
The way I would approach is to have a Boolean field and update it to true while running in the context of a batch execution.
And,in the trigger I will check of this value is false then Trigger should execute ,if it is True then it should not.
Hope this helps!!
- [adinserter block='9']
-
Yes, you can run batches using trigger.
For example:
we have an object called AccountUpdates, in that object we have a picklist field called Status. when the Informatica daily load are completed they will insert one record into AccountUpdates object and put the status value to “Acc Load Completed” and save the record.
based on the that status field value trigger(after insert or after update) will fire and run the batch apex.
Thanks
Log In to reply.