You need to sign in to do that
Don't have an account?

Help with Apex Scheduler
Hi,
Iam trying to schedule a apex job that runs for every 30 mins from 6PM to 11 PM. Here is the scheduler iam trying to use
ScheduledClass obj= new ScheduledClass();
String sch = '0 0,30 18,19,20,21,22,23 ? * MON-FRI';
System.schedule('My Job', sch, obj);
But iam getting the below error
System.StringException: Seconds and minutes must be specified as integers: 0 15,30,45 18,19,20,21,22,23 ? * MON-FRI
Is there any way we could scehdule a job which could run for every 30 mins starting from 6 PM and ending at 11.30 PM??
Thanks
Iam trying to schedule a apex job that runs for every 30 mins from 6PM to 11 PM. Here is the scheduler iam trying to use
ScheduledClass obj= new ScheduledClass();
String sch = '0 0,30 18,19,20,21,22,23 ? * MON-FRI';
System.schedule('My Job', sch, obj);
But iam getting the below error
System.StringException: Seconds and minutes must be specified as integers: 0 15,30,45 18,19,20,21,22,23 ? * MON-FRI
Is there any way we could scehdule a job which could run for every 30 mins starting from 6 PM and ending at 11.30 PM??
Thanks
Try this piece of code:-
ScheduledClass obj= new ScheduledClass();
String sch = '0 30 18-23 ? * MON-FRI';
System.schedule('My Job1', sch, obj);
Thanks
Anil.B
ScheduledClass obj= new ScheduledClass();
String seconds = ’0′; //Execute at Zero Seconds
String minutes = ’30,60′; //Execute at every 30th minute of hour
String hours = ‘18-23’; // Execute between 6 -11 pm
String dayOfMonth = ‘*’; // Execute Every Day of the Month
String month = ’*′; //Execute every month
String dayOfWeek = ‘?’; //Execute on all 7 days of the Week
String year = ’2014′; //Execute only for year 2014
String sch = seconds + ‘ ‘ + minutes + ‘ ‘ + hours + ‘ ‘ + dayOfMonth + ‘ ‘ + month + ‘ ‘ + dayOfWeek + ‘ ‘ + year;
system.schedule(‘schedule1’, sch, obj);
Regards
Nitesh Gadkari
@anibathula... your expression will run at 6.30 PM , 7.30 PM etc .. I want the clas to run at 6.30PM , 7.00PM , 7.30 PM etc
@nitesh .. i tried yours but it is throwing error as System.StringException: Minute and Second values must be between 0 and 59
try
String minutes = ’0,30′; //Execute at every 30th minute of hour
or
String minutes = ’0,30,0′; //Execute at every 30th minute of hour
its just giving me the same error message System.StringException: Seconds and minutes must be specified as integers:
i tried below two.
ScheduledClass obj= new ScheduledClass();
String sch = '0 0,30 18,19,20,21,22,23 ? * MON-FRI';
System.schedule('My Job', sch, obj);
ScheduledClass obj= new ScheduledClass();
String sch = '0 0,30 ,0 18,19,20,21,22,23 ? * MON-FRI';
System.schedule('My Job', sch, obj);