Interview Question
Qus: How to schedule batch apex?
Answers (1)
After writing the above mentioned classes to schedule navigate to: Develop > Apex Classes > Schedule Apex.
By clicking on Schedule Apex button we can schedule the batch class through user interface.
Note: Through user interface we cannot schedule in hours/minutes.
Schedulable Class Syntax:
global class SchedulableUsage implements Schedulable {
global void execute(SchedulableContext sc) {
BatchUsage bu = new BatchUsage();
//Database.executeBatch(bu);//Default Batch Size is: 200.
Database.executeBatch(bu,1500);//Max. Batch Size is: 2000.
}
}