Schedulable Methods The following are methods for Schedulable.
execute(context)
global class MySchedulableClass implements Schedulable {
global void execute(SchedulableContext ctx) {
CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime
FROM CronTrigger WHERE Id = :ctx.getTriggerId()];
System.debug(ct.CronExpression);
System.debug(ct.TimesTriggered);
Merchandise__c m = new Merchandise__c(
Name='Scheduled Job Item',
Description__c='Created by the scheduler',
Price__c=1,
Total_Inventory__c=1000);
insert m;
}
}
Sorry may be you are confused, i know about schedule class, my question is in schedule class from the execute method can i call a normal batch class method ?
i know is it possible to call batch class..like that can call noemal apex class method ?
Ofcourse you can call a batch process from a schedule class. Thus making the batch process to be scheduled. Please check the sample code that can be inserted in the execute method of schedule class.
BatchApexclass bc = new BatchApexclass (); Database.executeBatch(bc);
http://www.infallibletechie.com/2012/05/apex-scheduler.html
1) https://developer.salesforce.com/docs/atlas.en-us.apex_workbook.meta/apex_workbook/apex_scheduling_1.htm
2) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_system_schedulable.htm
Schedulable Methods
The following are methods for Schedulable.
execute(context)
How to schedule
http://www.infallibletechie.com/2012/05/apex-scheduler.html
Please let us know if this will help you
Sorry may be you are confused, i know about schedule class, my question is in schedule class from the execute method can i call a normal batch class method ?
i know is it possible to call batch class..like that can call noemal apex class method ?
i think now it is clear ...!
Thanks
Ofcourse you can call a batch process from a schedule class. Thus making the batch process to be scheduled.
Please check the sample code that can be inserted in the execute method of schedule class.
Database.executeBatch(bc);
Regards,
Deepthi