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
Alvin TanAlvin Tan 

Limit of Apex Scheduled/Batch Jobs

Is there a way to programmatically get the max number of allowable queued or active scheduled/batch jobs? The Limits class looks like it has most of the limits but not getting the max number of schedulable apex jobs. I understand the standard limit is 5, but is there a case where this number can vary?
@Amit Kumar Giri@Amit Kumar Giri
Practically there is not a limit class method that will say the max. However you can check about the running job with status by "cronTrigger" and can do some twick to use this to know how many job is active and whether u should scedule more or not.
SELECT Id, CronJobDetailId, NextFireTime, PreviousFireTime, State, StartTime, EndTime, CronExpression, TimeZoneSidKey, OwnerId, LastModifiedById, CreatedById, CreatedDate, TimesTriggered FROM CronTrigger
And also this limit itself is confusing accross salesforce documentation. you will see contradictory statement. But the fact about max is 5.
Refer this for more