function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ipsips 

How to abort next execution of batch in batch job?

Hi,

I need to abort entire batch job if I get exception in any particular batch.

For e.g.. I have 10 batches for batchJob and exception occurred while executing 1 batch, next execution of batches are need to be aborted.

 

I have used System.abortJob()  method to abort the batch. But still I am not able to stop the next batch execution.

 

Thanks in advance..:)

Starz26Starz26

you could implement database.stateful

 

add a flag for abort

 

boolean abort = false;

 

check that flag and if true abort jub

 

now when the first error happens, set flag = true

ipsips

Hi,

Thanks for reply.

 

By using flag check I can avoid the execution of inner code of execute method.

But it will not stop next iteration of my batch. I think System.abortJob() method work in async. manner.