You need to sign in to do that
Don't have an account?
nihar
can anyone help how to schedule a batch for every two minutes
Hi All,
how to schedule batch class for every 2 minuets
My Batch class :
global class InsertIterableBatch implements database.Batchable<Slot__c> {
global Iterable<Slot__c> start (database.Batchablecontext bc){
list<Slot__c> slotReclist = new list<Slot__c>();
for(integer i=0;i<100;i++){
Slot__c slotRe = new Slot__c();
slotre.RecordTypeId = '01228000000SxvX';
slotRe.Duration__c = 1;
slotRe.start_date_time__c = Datetime.newInstance(2018,5,1,15,0,0);
slotRe.End_Date_Time__c = Datetime.newInstance(2018,5,1,15,0,0);
slotRe.Max_No_Of_Students__c = 10;
slotReclist.add(slotRe);
}
return slotReclist;
}
global void execute (database.BatchableContext bc, list<Slot__c> slotreclist){
insert slotReclist;
}
global void finish (database.Batchablecontext bc){
}
}
how to schedule batch class for every 2 minuets
how to schedule batch class for every 2 minuets
My Batch class :
global class InsertIterableBatch implements database.Batchable<Slot__c> {
global Iterable<Slot__c> start (database.Batchablecontext bc){
list<Slot__c> slotReclist = new list<Slot__c>();
for(integer i=0;i<100;i++){
Slot__c slotRe = new Slot__c();
slotre.RecordTypeId = '01228000000SxvX';
slotRe.Duration__c = 1;
slotRe.start_date_time__c = Datetime.newInstance(2018,5,1,15,0,0);
slotRe.End_Date_Time__c = Datetime.newInstance(2018,5,1,15,0,0);
slotRe.Max_No_Of_Students__c = 10;
slotReclist.add(slotRe);
}
return slotReclist;
}
global void execute (database.BatchableContext bc, list<Slot__c> slotreclist){
insert slotReclist;
}
global void finish (database.Batchablecontext bc){
}
}
how to schedule batch class for every 2 minuets
Mark as best answer, If it resloves !!
Go to your developer console -> Open Execute Anonymous Window -> Copy and Paste Below code and click on execute button
After this, if you want To check apex class in scheduled or not then:
Go to -> Setup -> Jobs -> Scheduled Jobs
Thanks,
Bhanu Prakash
visit ForceLearn.com (https://www.forcelearn.com)
All Answers
Mark as best answer, If it resloves !!
Go to your developer console -> Open Execute Anonymous Window -> Copy and Paste Below code and click on execute button
After this, if you want To check apex class in scheduled or not then:
Go to -> Setup -> Jobs -> Scheduled Jobs
Thanks,
Bhanu Prakash
visit ForceLearn.com (https://www.forcelearn.com)
Try this:
String sch = '0 5 * * * ? ';// CRON expression for every five minutes
String jobID = System.schedule('Job name 1', sch, new InsertIterableBatch());
Let me know if it helps
Thanks
Thanks,
Bhanu Prakash
visit ForceLearn.com (https://www.forcelearn.com)