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
rahulsharmarahulsharma 

Montitoring Apex Batch Jobs

Hello,

I'm facing problem with Batch..

Two batches are called one after another .. such that final result of first batch is providing data to second Batch,

My Code is working if its an Ideal condition, i.e. second batch starts after first batch is fully executed..

but if second batch executes while first is still executing then it creates problem..

So my problem is that, i want to control the execution of second batch..

im already using other schedulars so im trying to avoid it....

is there any way to monitor batch jobs means to put conditions on when second batch executes

Thank You

crop1645crop1645

Rahulsharma

 

Yikes -- the only reliable persistent state you can use is a SFDC custom object that batch one updates when it is finshed and batch 2 reads before it starts.  You'll need some naming conventions here for the value(s) in this custom object since your batch1-batch 2 sequence will presumably run repeatedly over the calendar