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
sfg1sfg1 

How to identify a batch job which is not scheduled in organization

I have many batch jobs in my organization, i need to remove the unused batch jobs in my organization. I am checking Schedule Apex and Scheduled jobs. But it is taking more time. Is their any way to query Batch jobs which are not scheduled. PLease guide me. 
D-CoderD-Coder
Here is the query,
 
SELECT ApexClassId,Id,MethodName,Status FROM AsyncApexJob WHERE Status IN ('Completed','Failed','Aborted')

 
sfg1sfg1
Thanks NLLesh for your quick reply. Status 'Failed' and 'Aborted' is batch stopped due to some reasons. But i need batch jobs which are not scheduled in Organization. If i am wrong please correct me. Thanks.
D-CoderD-Coder
Not scheduled means anyone status from ('Completed','Failed','Aborted').
Whereas you can find scheduled in status like Holding , Queued, Preparing, Processing.

Above is the answer to your question "i need batch jobs which are not scheduled in Organization".

Let me know if I get your question correctly. I suppose you are looking for BatchJobs which are never scheduled and unused. Let me know if you need answer of this.