Batch Class
global class BatchClass implements Database.Batchable<sobject>
{
global Database.QueryLocator start(Database.BatchableContext BC){
String Query='Select LastName,Id from Lead';
return Database.getQueryLocator(Query);
}
global void Execute(Database.BatchableContext BC,List<sobject> Scope){
List<Lead> ld = Scope;
for(Lead l: ld){
l.LastName = l.LastName+'Batch testing';
}
}
global void finish(Database.BatchableContext BC){
}
}
Schedule Class
global class ScheduleClass implements Schedulable {
global void execute(SchedulableContext sc) {
BatchClass b = new BatchClass();
database.executebatch(b);
}
}
No comments:
Post a Comment