+ Start a Discussion

How to check if scheduled job is expired or not ?

We have scheduled a job year a go, and it might have expired now, but we are unsure about it, how to check if its still running or expired ?
Already tried with CronTrigger object !
Parmanand PathakParmanand Pathak

Goto Setup---> Scheduled Jobs where you can see Next Scheduled Run.

User-added image

Parmanand Pathak

Hi Parmanand, 

Thanks for the reply, but i wanted to see the expired scheduled jobs. Schedules Job section not displaying expired jobs.

Raj VakatiRaj Vakati
You cant able to directly get in one SOQL query 

EndTime is the field on the  one which you need to check the crontrigger 

Use this code to get the details
List<CronTrigger> cTrigger =[Select Id ,EndTime,StartTime ,CronJobDetail.Name From CronTrigger];

Set<Id> jobIdsThatAreExpired = new Set<Id>();
For(CronTrigger c : cTrigger){
        System.debug('Expired Jobs'+c.Id);