+ Start a Discussion
JBabuJBabu 

To schedule many batch jobs in one scheduled job

Hi,

 

I have few batch jobs and they can act on same record.

Currently I am scheduling through through different scheduled jobs. They are working fine.

As there cannot be more than 5 scheduled jobs running at at point. I wanted to combine mutiple batch jobs in to one scheduled job.

Please let me know if any one can help me out on this.

 

Thanks

JBabu.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
RoyGiladRoyGilad

Hi,

I had the same problem and I approached it using a single scheduled class that calls my batch jobs:

 

global class Run_Scheduled_Jobs implements Schedulable{
global void execute(SchedulableContext sc)
{
try{
Process1.invoke();
}
catch(Exception e)
{
 }
try{
Process2.invoke();
}
catch(Exception e)
{
 }
}

 

All Answers

RoyGiladRoyGilad

Hi,

I had the same problem and I approached it using a single scheduled class that calls my batch jobs:

 

global class Run_Scheduled_Jobs implements Schedulable{
global void execute(SchedulableContext sc)
{
try{
Process1.invoke();
}
catch(Exception e)
{
 }
try{
Process2.invoke();
}
catch(Exception e)
{
 }
}

 

This was selected as the best answer
Damien_Damien_

My company has a project where they created a scheduled class to fire 4 times a day.  We also have a 'gatekeeper' object.  The first time the scheduled job fires, it fires the first batch.  Second time the second and so on.  Each batch sets an associated value on our gatekeeper.

JBabuJBabu

Hi SF-Roy,

 

Thanks for the inputs. It worked now. 

(my bad earlier there was issue in one of the batch jobs).

 

Thanks,

JBabu.