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

Apex scheduler
Hi,
On researching on apex scheduler to for scheduling a class for every 10 or 15 mins we would need to write the schedule code in the system log.
YourScheduleClass c = new YourScheduleClass(); String sch = '0 0 * * * ?'; System.schedule('Schedule Job1', sch, c); YourScheduleClass c = new YourScheduleClass(); String sch = '0 10 * * * ?'; System.schedule('Schedule Job2', sch, c); YourScheduleClass c = new YourScheduleClass(); String sch = '0 20 * * * ?'; System.schedule('Schedule Job3', sch, c); YourScheduleClass c = new YourScheduleClass(); String sch = '0 30 * * * ?'; System.schedule('Schedule Job4', sch, c);
Would these entries be an one time job on production env? Would it affect anything if i edit/change the times later?
if these jobs are scheduled once and you are trying to edit na then it will give you an error saying that scheduled jobs cant be edit ...then first u need to delete the current running jobs and create the new one.......other wise create the schedule string dynamically with local varibales... then u can do the same in the prod also.. but with static values like '0 10 ....' this u cant alert in the prod environment.....
where would i create the local variable? in the system logs?
not in system logs .. create a method to construct the string to schedule the class....for that accept the params as arguements
public void toschedule(string first,string second,string third.....){
then ur final string would be
string str = 'fisrt, second, ......';
sys.schedule........
}
then in system log...
create the instance of the class and call the method with your respective values as arguments...hope you got it now