+ Start a Discussion
jai.sjai.s 

Schedule Class to execute every 15m

Hi,

Please any one share sample code of schedule class to execute every 15m.

Regards,
Shaik
David Catindoy 11David Catindoy 11
You can schedule class to execute every 15 minutes using the scheduled jobs. Just make sure that your cron expression should look like this '0 15 ? * * ?' or you can use the Force.com platform to create scheduled jobs.
David Catindoy 11David Catindoy 11
Here's the format for cronExpression >> 'Seconds Minutes Hours Day_of_month Month Day_of_week Optional_year'
kiranmutturukiranmutturu
You can't do that directly I think if you do System.schedule('Job1', '0 15 * * * ?', new ApexScheduled1());) it wont execute for every 15 min..this kind of call will schedule the class for the 15th minute in that hour... not for every 15 min...
and one more observation u can't use getcontent method with in the schedulable interface.

But you can do some thing like this
 
System.schedule('Scheduled Job 1', '0 0 * * * ?', new ScheduledClass());
System.schedule('Scheduled Job 2', '0 15 * * * ?', new ScheduledClass());
System.schedule('Scheduled Job 3', '0 30 * * * ?', new ScheduledClass());
System.schedule('Scheduled Job 4', '0 45 * * * ?', new ScheduledClass());

 
David Catindoy 11David Catindoy 11
Hello. Is there really a necessity for you to do that? To tell you honestly apex scheduled jobs may fail unexpectedly due to that kind of implementation. Try to think that your batch apex class is processing enourmous amount of records or data. It really takes time to process those data and may cause for the failure of your scheduled apex.
jai.sjai.s
Thanks for ur support David and Kiran.