Notes
To retrieve information about Batch Apex Jobs, we commonly use SOQL on the AsyncApexJob
object. But what if you need to query Scheduled Jobs?
You can do this by querying the CronTrigger object. The CronTrigger object provides details about scheduled jobs, including their timing, status, and execution details. Below is an example SOQL query to retrieve the necessary information:
List<CronTrigger> trigger = [SELECT Id,
CronJobDetail.Name,
CronExpression,
CronJobDetailId,
StartTime,
State,
TimesTriggered
FROM CronTrigger];