Skip to content

Instantly share code, notes, and snippets.

@victorabraham
Created September 17, 2021 04:42
Show Gist options
  • Save victorabraham/af3136eeb12396a9cc8728cdc6e1d26b to your computer and use it in GitHub Desktop.
Save victorabraham/af3136eeb12396a9cc8728cdc6e1d26b to your computer and use it in GitHub Desktop.
List<AsyncApexJob> trackerJobs = [SELECT Id, Status, ApexClassID FROM AsyncApexJob WHERE Status IN ('Holding', 'Queued','Processing','Preparing')
AND ApexClassID IN (SELECT Id FROM ApexClass WHERE Name = 'TrackerSchedulable')];
if(!trackerJobs.isEmpty()) {
//Apex jobs are running for specified class
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment