+ Start a Discussion
viktorVviktorV 

Scheduler problem

Hi,

 

I've created a one-time scheduled apex, which sends out an email 5 days after a value changes on a custom object.

I get the next error:

System.AsyncException: Based on configured schedule, the given trigger will never fire.

 

My code is the next for scheduler:

 

Datetime plus5 = Datetime.now().addDays(5);
String sched = plus5.second()+' '+plus5.minute()+' '+plus5.hour()+' '+plus5.day()+' '+plus5.month()+' ? '+plus5.year();

schClass sch = new schClass();
System.schedule('Sending follow up mail',sched,sch);

What is the problem?

 

Thank you,

Viktor 

 

Best Answer chosen by Admin (Salesforce Developers) 
viktorVviktorV

hmm...

 

found the problem...so dummy.

for testing my code, I tried to schedule the job for Datetime.now(); which is in the past by a second when calling the schedule() method

 

cannot create scheduled job for the past :D

All Answers

kiranmutturukiranmutturu

nothing wrong with code......its abs fine....may be this is because of the object using in this,,,

viktorVviktorV

hmm...

 

found the problem...so dummy.

for testing my code, I tried to schedule the job for Datetime.now(); which is in the past by a second when calling the schedule() method

 

cannot create scheduled job for the past :D

This was selected as the best answer
kka_zzzsaikka_zzzsai

Can you please let me know what you did in your above code to solve the problem?