The following will create a Schedule to run every hour, starting on the next hour from submission.
System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() );
Given this, create a scheduled class that can be scheduled on the day you need.
public with sharing class MyScheduleStart implements Schedulable { public void execute(SchedulableContext ctx) { System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() ); } }
I have done the same already. The job is schdeuled but its not running on the time it was schduled to run. In the apex jobs the scheduler is queued but the batch class this schdeuler is supposed to call is not running. The next run time is a past time.
Please try below script and CRON expression.
The following will create a Schedule to run every hour, starting on the next hour from submission.
System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() );
Given this, create a scheduled class that can be scheduled on the day you need.
public with sharing class MyScheduleStart implements Schedulable
{
public void execute(SchedulableContext ctx)
{
System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() );
}
}
Please mark it best if it helps you. Thanks.
I have done the same already.
The job is schdeuled but its not running on the time it was schduled to run. In the apex jobs the scheduler is queued but the batch class this schdeuler is supposed to call is not running. The next run time is a past time.
Regards,
Megha