We often find ourselves in a situation where a specific code block that is stringed together in trigger which should not be executed in batch mode. The reason might be that batch execution might be triggering more number of triggers and hit any given governed limits. To achieve this in there is a method available in System class.

  1. !system.isBatch() – available for more information in this page
  2. Example Code Block: include this method in classes involved in trigger context to avoid executing in batch context.
if(!System.isBatch()) {           
    //call service class        

1 comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: