I have a trigger that needs to be run during a Bulk API insert/update of records but that needs to not run during an Batch Apex Job like:

global class myBatchClass implements Database.Batchable<sObject> {}

My question is will using !System.isBatch() affect the Bulk API job, as of now it is working correctly on my Apex Batch which is what I want.

1 Answer 1


No, it won't. Processing of records in a Bulk API job is not treated as an Asynchronous Apex context. The System.isBatch() method

Returns true if a batch Apex job invoked the executing code, or false if not.

It will return false is code is invoked via trigger in the context of a Bulk API job.

  • Thank you. I saw a post with a similar answer, all of Salesforce's documentation uses the term "batch" very frequently when referring to bulk processing so I wanted to make sure
    – MMeadows
    Jul 23, 2019 at 15:10

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.