Starting a batch job from a batch job is fairly straightforward. The key is placement of the code that actually starts the new batch. The code that starts the new batch needs to be placed in the finish method of the initial batch. example:
global void finish(Database.BatchableContext BC) { //Add your start code for the other batch job here Database.executeBatch(new YourOtherBatchClass()); }
and to execute batch job2 10 mins after the batch job1 use scheduling
ProcessAccs pa= new ProcessAccs();// there should de name of you batch class String cronStr = '0 0,30 * * * *'; System.schedule('Process Accs Job', cronStr, pa);
run this code in anonymous window.
Kindly mark my solution as the best answer if it helps you.
ProcessAccs pa= new ProcessAccs();// there should de name of you batch class String cronStr = '0 0,10 * * * *'; System.schedule('Process Accs Job', cronStr, pa);
run this code in anonymous window.
Kindly mark my solution as the best answer if it helps you.
example:
global void finish(Database.BatchableContext BC)
{
//Add your start code for the other batch job here
Database.executeBatch(new YourOtherBatchClass());
}
and to execute batch job2 10 mins after the batch job1 use scheduling
Please use below code :
ProcessAccs pa= new ProcessAccs();// there should de name of you batch class
String cronStr = '0 0,30 * * * *';
System.schedule('Process Accs Job', cronStr, pa);
run this code in anonymous window.
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
Please use below code :
ProcessAccs pa= new ProcessAccs();// there should de name of you batch class
String cronStr = '0 0,10 * * * *';
System.schedule('Process Accs Job', cronStr, pa);
run this code in anonymous window.
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh