# Write a SOQL query on CronTrigger and CronJobDetail to find all currently scheduled Apex jobs and their next fire time.

**Topic:** Development · **Difficulty:** Medium · **Asked at:** Infosys, Wipro, LTIMindtree · **Tags:** soql, scenario, scheduled-apex, monitoring

Read it on the site: https://www.forcechallenges.com/interview-questions/write-a-soql-query-on-crontrigger-and-cronjobdetail-to-find-all-currently-scheduled-apex-jobs-and-their-next

## Answer

Scheduled jobs live in `CronTrigger`, with the job name in the related `CronJobDetail`.

```soql
SELECT Id, CronJobDetail.Name, CronJobDetail.JobType, State, NextFireTime, PreviousFireTime, CronExpression
FROM CronTrigger
WHERE State IN ('WAITING', 'ACQUIRED', 'EXECUTING')
ORDER BY NextFireTime
```
Scheduled Apex jobs have `CronJobDetail.JobType = '7'`.

---
Source: ForceChallenges · last updated 2026-10-19
