[SalesForce] How to get the end date of a scheduled job which was scheduled via System.Schedule

A year back I scheduled "Scheduled Apex" job via System.Schedule method (anon apex).

The job has been running once a day during this time.

Today I would like to check the end date (if any) of this scheduled job.

I could not find this information (end date of this job) from Salesforce UI.

Is there any way by which I can get this information ?

Basically we would need this job to run nonstop (once a day).

Best Answer

You want the EndTime field on the CronTrigger object. You could see the end date for all scheduled jobs with this query:

SELECT EndTime, CronJobDetailId, CronJobDetail.Name
FROM CronTrigger WHERE CronJobDetail.JobType = '7'

You could of course hard code or otherwise filter on CronJobDetailId to meet your specific needs.

Related Topic