global with sharing class ScheduledBatchable implements Schedulable{
global void execute(SchedulableContext sc) {
CronTrigger cronTrigger= [SELECT CronJobDetail.Name, PreviousFireTime, State FROM CronTrigger where State = 'EXECUTING' AND CronJobDetail.Name like 'Email%'];
List<Payroll__c> payroll = [SELECT Id, FORMAT(Row_DateTime_API01__c),Row_Text_API05__c,Row_Text_API06__c,RecordType.name,
FROM Payroll__c WHERE Row_DateTime_API01__c =: cronTrigger.PreviousFireTime];
PayrollSendEmailBatch payrollSendEmailBatch = new PayrollSendEmailBatch(payroll);
Database.executeBatch(payrollSendEmailBatch,200);
}
}
Hi @盼盼 杨,
Please checkout the following links, which provides guidance on writing a test class for the Schedulable interface:
https://salesforce.stackexchange.com/questions/17428/test-class-for-schedulable-interface
Thanks