I have seen many posts about finding out name of the apex class associated with a scheduled job. However, i have an opposite need.

I am updating a scheduled class, that was scheduled to run at a certain frequency every week. It was scheduled several years ago, so at this stage, nobody remembers the Job name.

Before i can deploy my edited class, i need to de-active the scheduled job associated with the class, otherwise deploy will fail.

So my question is, if i have a schedulable apex class xyz.cls. Is there a way to find out IF it is scheduled to run already? If yes, is there a way to find out what's the job name and whats the schedule frequency?

  • 2
    Are you aware there is a setting that will allow you to deploy regardless of whether a job is running or is scheduled? Jul 9, 2020 at 22:10

2 Answers 2


There are two things for you here:

  1. Go to Setup -> Deployment Settings and check the box labeled "Allow deployments of components when corresponding Apex jobs are pending or in progress."

Note, as the label itself explains, enabling this option may cause Apex jobs to fail.

  1. If, for whatever reason, item 1 is not good enough, you can query the AsyncApexJob object. There property ApexClassId that will give you the apex class.

For example, you can do:

SELECT <yourFields> 
FROM AsyncApexJob
WHERE ApexClass.Name = <Your class Here>
  • 1
    Unfortunately this doesn't help you know the name of the scheduled job, of course, and there doesn't appear to be a way to attack it from the other end using CronTrigger and CronJobDetail either. However, using the setting should be good enough.
    – Phil W
    Jul 9, 2020 at 22:21
  • Help me out here, because I am second-guessing myself. Can you do System.abortJob(xxx) with the ID out of that object? Jul 9, 2020 at 22:22
  • Nevermind, you can. So, while you don't get the Job Name, you can abort it anyway using apex. You still can't unschedule it, though. Reference: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… Jul 9, 2020 at 22:23
  • @SebastianKessel Yes I am aware of that setting you mentioned. And we do have it checked, so it shouldn't be problem. But i found out about that setting only few days ago, and before that, i was trying to find the job name. Even though, its not needed anymore (due to that setting being checked), i was curious about finding job name from class name. So looks like there is no good way for it. But thank you for your responses. Confirming my understanding about that deployment setting itself was great help. Jul 10, 2020 at 5:34

I struggle with this sometimes and everytime figure out a different way of tackling it. This time however I think I got a dependable solution, hence posting:

SELECT ApexClassId,CronTriggerId,crontrigger.cronjobdetail.name FROM AsyncApexJob where apexclass.name = 'you apex class name' order by completeddate desc

crontrigger.cronjobdetail.name gives you the info you are looking for.

You must log in to answer this question.

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