function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vino2vijayvino2vijay 

Save error: Schedulable class has jobs pending or in progress - Even deleted all jobs

Hi All,

 

while saving my controller i got error like  "Schedulable class has jobs pending or in progress" .

 

Note : 1. There s no scheduled jobs based on my controller.

            2. I dont see any scheduled jobs in UI.

 

Now i m trying to abort the running job which is running invisible.. i really dont know my job id .... Kindly let me know  how i fetch on jobid based on classid?

 

URGENT .....

 

Thanks,

 

 

souvik9086souvik9086

Hi,

 

SELECT Id, (SELECT id,name FROM AsyncapexJobs) FROM ApexClass WHERE Id =: ApexClassID

 

You may get the list of ids of jobs for the particular apex class id.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

Avidev9Avidev9
Have a look at Setup > Monitoring > Scheduled Jobs.

Well doesnt need to be the same class.If Any schedulable class that uses your cotroller/code is scheduled then you will get this error.
Mayank_JoshiMayank_Joshi

Well in addition to the already given answers . Another scenario could be ,it can occur if in any of your Org's Test class OR Run All Test is trying to execute your Scheduler/batch process in that instant of time your respective class will give this error : Schedulable class has jobs pending or in progress .

 

Once ,this test process will finish then you can work on this class. Also try to remove class name from any of the Apex scheduler (if any) . Try to run /check debug log (if you could) .

vino2vijayvino2vijay

HI Mayank,

I am also feel it might be running from test class ... can u please let me know how to get job id ?

Mayank_JoshiMayank_Joshi
I guess, if it is running through Test Method then it will not generate any JobID . Because , Data in Test Method will not comitt to Database .It is only checking your class logic .

But , in any case if there is any schedule Job then you can find here : Setup | Monitoring | Scheduled Jobs . If you can find then under Developer console you can run this script to Abort this Job : System.abort('YOU JOB ID');

Else, log a case with SFDC they will abort your Job .

Thanks.
vino2vijayvino2vijay

Yeap ur correct .. testmethod wont be generate any job id ... Better i will create a case ..

 

Thanks