I have one apex schedulable class. I am trying trying to search class in All Scheduled Jobs,but I don't know the name of job for that particular apex class.

How should I find the job name for that scheduled class?

3 Answers 3


You can run following query to find out the job name

SELECT CronJobDetailId,cronjobdetail.Name,EndTime,Id,LastModifiedById,
NextFireTime,OwnerId,PreviousFireTime,StartTime,State FROM CronTrigger 
where state='WAITING' and cronjobdetail.JOBTYPE='7'

Possible STATE values are which you can use to filter results are :

  • WAITING—The job is waiting for execution.
  • ACQUIRED—The job has been picked up by the system and is about to execute.
  • EXECUTING—The job is executing.
  • COMPLETE—The trigger has fired and is not scheduled to fire again.
  • ERROR—The trigger definition has an error.
  • DELETED—The job has been deleted.
  • PAUSED—A job can have this state during patch and major releases. After the release has finished, the job state is automatically set to WAITING or another state.
  • BLOCKED—Execution of a second instance of the job is attempted while one instance is running. This state lasts until the first job instance is completed. PAUSED_BLOCKED—A job has this state due to a release occurring. When the release has finished and no other instance of the job is running, the job’s status is set to another state.
  • 2
    Thanks.But i want to know the job name for perticular apexclass. Like I have a Apex class name MyControllerClass and it sheduled. But how cant i find Scheduled job for the above class. Commented Nov 19, 2015 at 3:54
  • how many result you see with thst query ?
    – Himanshu
    Commented Nov 19, 2015 at 4:08
  • I can see 67 results Commented Nov 19, 2015 at 4:14

Good news, this is possible. As discussed in How can I query the class which the schedule job will call the CronTrigger and CronJobDetail tables which underly schedule jobs have a gaping hole in that they don't include details about the associated apex class id (at least that they expose). See the these two ideas to vote it up.

In some cases if you go to setup->monitor->jobs->scheduled jobs, and you'll see a list of all scheduled jobs. For apex classes that were scheduled through the 'Schedule Apex' button in setup->develop->apex classes, you'll see a 'Manage' link next to the job. Click that and you'll see the class name associated with that job.

However, it turns out the metadata api is kind enough to return the id of the CronTrigger records associated with an apex class if you try and delete it.

So let's say your class is MySchedulableClass you would have the following destructiveChanges.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

If you do a test deployment, you'll get an error like the following which includes the crontrigger ids (they start with 08e)

/Users/yourname/ant/sfse/build.xml:95: The following error occurred while executing this line:
*********** DEPLOYMENT FAILED ***********

All Component Failures:
1.  classes/MySchedulableClass.cls -- Error: This apex class is referenced elsewhere in salesforce.com.  Remove the usage and try again. : Scheduled Jobs - 08eXXXXXXXXXXXX. This Schedulable class is in use. : Apex Class.

*********** DEPLOYMENT FAILED ***********

Once you have those ids you can then query the related job names

SELECT CronJobDetail.Name FROM CronTrigger WHERE Id = '08eXXXXXXXXXXXX'

Since API v53.0 you can do the following to get the job name when you know the apex class if it is related to a BatchApex or a ScheduledApex job :

SELECT Id, ApexClass.Name, MethodName, JobType, Status, LastProcessed, JobItemsProcessed, NumberOfErrors
FROM AsyncApexJob
WHERE ApexClass.Name = 'Name of your class'
AND JobType in ('BatchApexWorker', 'ScheduledApex')

Be aware that it does not work through api (with navigator extensions for example) only in dev console or apex code.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .