function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srikeerthisrikeerthi 

Reg: Scheduled Job State as 'Waiting' though Completed execution?

Hi

 

I have doubt regarding Scheduled Job State,I have Scheduled an Apex Class for a particular time,

So it completed execution,after completion of Scheduling the State of Scheduled Job is shown

as WAITING, though it has completed.

 

Why the State of Job is in still WAITING state after the Scheduled Time.If any one know about

please clarify me.

 

Thanks  

lakslaks

Hi Keerthi,

 

I think you would have mentioned '*' for any of the value in your Cron expression which is causing the job to be scheduled again as per that. In effect it is not getting "Completed".

 

Although the particular scheduled job has completed it's current execution, it is scheduled again for the next execution since the Cron expression is so.

 

However if you change your Cron expression in such a way that the job would be scheduled for only a single run, you can see that the status changes to "COMPLETE" and subsequently "DELETED".

 

For eg. consider a Cron expression  '0 0 14 21 NOV ? 2011' in which the job is scheduled for just a single run at 2.00pm on Nov 21st. Once the run is over, if the State is checked in the CronTrigger object you can see that it would have changed to "DELETED" and with no "NextFireTime".

 

(As far as I have observed the job goes to the State "COMPLETE" at some intermediate point after which you can see the status as "DELETED".)

 

I hope the above helps you.

 

Regards,

Lakshmi.