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
Sagar Hinsu 11Sagar Hinsu 11 

how to get list of batch jobs through query or api

Hello,
In my org I have certain number of batch jobs.
I want a list of batch job.
Can I retrieve it through query or API?
I know its a very silly question. But if there is any way to fetch the all batch jobs please let me know.
I have an custom requirement thats why i want this.
Thank You.
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hello Sagar, 

Please try the below query.
SELECT Id, CronJobDetail.Id, CronJobDetail.Name, CronJobDetail.JobType 
FROM CronTrigger ORDER BY CreatedDate DESC

Thanks,
Vinoth
Sagar Hinsu 11Sagar Hinsu 11
Thanks Vinoth.
But it fetched Zero rows only.
I will explain it again my requirement.
I want a list of batch jobs, not the jobs with are running currently.
 
Chandra Sekhar CH N VChandra Sekhar CH N V
SELECT Id, Name, JobType FROM CronJobDetail
FinnArildMusicFinnArildMusic
SELECT Id, JobType, Status  from AsyncApexJob where JobType='BatchApex' limit 10