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

How to restart scheduled apex job
I have a class which implements schedulable and below class which schedules the job
public class LeadNotContactedStart{
public void startRun() {
leadNotContactedImplimentation dtr = new leadNotContactedImplimentation();
String sch = '0 0 * * * ?';
if(test.isrunningtest()){
system.schedule('Lead not contacted Test', sch, dtr);
}
else{
system.schedule('Lead not contacted', sch, dtr);
}
}
}
I needed to to edit the class which implements the schedulable in order to achieve that I had to delete the existed running scheduled job. Now after editing how could I restart same job.
public class LeadNotContactedStart{
public void startRun() {
leadNotContactedImplimentation dtr = new leadNotContactedImplimentation();
String sch = '0 0 * * * ?';
if(test.isrunningtest()){
system.schedule('Lead not contacted Test', sch, dtr);
}
else{
system.schedule('Lead not contacted', sch, dtr);
}
}
}
I needed to to edit the class which implements the schedulable in order to achieve that I had to delete the existed running scheduled job. Now after editing how could I restart same job.
Go to Your Name (Nearar to setup) --> Developer Console --> Debug --> Open Execute Anonymous Window
Paste this code : Click on Execute
All Answers
Go to Your Name (Nearar to setup) --> Developer Console --> Debug --> Open Execute Anonymous Window
Paste this code : Click on Execute
ScheduleSalesTargets c = new ScheduleSalesTargets();
c.execute(null);
OR
Check the Time Now, if it is, let's say 10:39 AM, in your clock, then set the minute to 41. This will schedule the job for 10:41 AM just two minutes from now. But, if you set minute value to 38, then it will schedule to next hour 11:38 AM
ScheduleSalesTargets c = new ScheduleSalesTargets();
String sch = '0 0 * * * ?';
System.schedule('Sales Target Job11', '0 41 * * * ?', c);