I was just wondering is it possible to class executeBatch method of two different Batchable classes inside the execute method of a Schedule class. For example;
global class BatchClassA implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
//query goes here;
}
global void execute(Database.BatchableContext BC, List<Child__c> scope)
{
//execution goes here
}
global void finish(Database.BatchableContext BC)
{
}
}
global class BatchClassB implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
//query goes here;
}
global void execute(Database.BatchableContext BC, List<Child__c> scope)
{
//execution goes here
}
global void finish(Database.BatchableContext BC)
{
}
}
global class Scheduler_class implements Schedulable{
global void execute(SchedulableContext sc) {
BatchClassA b1 = new BatchClassA();
ID batchprocessidA = Database.executeBatch(b1,50);
BatchClassB b1 = new BatchClassB();
ID batchprocessidA = Database.executeBatch(b1,50);
}
}
Will this actually work?