Activity Forums Salesforce® Discussions Does trigger run batches?

  • Radhakrishna

    Member
    July 4, 2017 at 8:55 am

    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!!

  • Parul

    Member
    September 15, 2018 at 7:31 pm

    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.

Popular Salesforce Blogs

Popular Salesforce Videos