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
mohan s 37mohan s 37 

How to get the jobName using apex scheduleClass name or id?

     I want to get the jobname for the schedule class by using apex schedule class name or id. I don't know the when it was scheduled and job Name. Now I would like to add this schedule class and reschedule it again. When i try to add this job i am getting the following error "This Apex class has batch or future jobs pending or in progress" .

Mohan S
balaji Jayararmanbalaji Jayararman
Hi Mohan,

Please find the below steps to find the job details

From Setup, enter Jobs in the Quick Find box, then select Apex Jobs.


Please refer the below link to monitor your jobs.

Please mark this as best answer if it helps.

Balaji J
Hi Mohan,
You Can achieve this by using following code and refer the following link to find more 
String cronID = System.scheduleBatch(reassign, 'job example', 1);

CronTrigger ct = [SELECT Id, TimesTriggered, NextFireTime
                FROM CronTrigger WHERE Id = :cronID];

// TimesTriggered should be 0 because the job hasn't started yet.
System.assertEquals(0, ct.TimesTriggered);
System.debug('Next fire time: ' + ct.NextFireTime); 
// For example:
// Next fire time: 2013-06-03 13:31:23

If you found this answer helpful then please mark it as best answer so it can help others.

Ajvad AjuAjvad Aju
Hi Mohan,

From setup enter jobs and select Scheduled Jobs, Then you can see your org's Scheduled jobs. 

Look into this screenshot

User-added image 
If your org has too many jobs that scheduled to the future, then you will get an error "This Apex class has batch or future jobs pending or in progress". To avoid this error please delete unwanted errors from the page.

Ajvad Aju