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
sayirbsayirb 

Abort Bach process on error

Hi,

 

    I have a Scheduled batch process which calls an External API (10 call outs in 5 jobs).  This is scheduled for every month. Sometimes "Timeout error " occurs in  External API.  

 

 I want to abort  all other Bach process if any error occurs, and reschedule the process for next day in the month.

 

How I can do it in Apex programming ?

 

I am struck with this problem, please help me

 

Thanks

 

 

Anup JadhavAnup Jadhav

You might want to look at serializing batch jobs that are dependent on each other.

 

Here's a cookbook solution that might kickstart some ideas:

 

http://developer.force.com/cookbook/recipe/serialize-batch-apex

 

This way if one job fails, the next in line won't run, and the system administrator will get notified.

 

- Anup