I am getting "AsyncApexExecutions Limit Exception" in below code -

Can anyone explain the issue? i have been getting more than 1 lakh records in start method using queryLocator but didn't get this exception. So what is wrong in this code

global class SyncCalendarsUpdates implements Database.Batchable<sObject>, Database.AllowsCallouts {
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT Id, Event_ID__c, Description__c, Event_Owner__r.Id, Subject__c, Start_Datetime__c, End_Datetime__c, Click_Key__c FROM Updated_Event__c';
        return Database.getQueryLocator(query);

    global void execute(Database.BatchableContext BC, List<Updated_Event__c> scope) {


    global void finish(Database.BatchableContext BC) { }
  • What sort of triggers do you have on Event and Updated_Event__c? – Adrian Larson Jan 20 '15 at 17:20
  • I am getting this exception if i comment entire code of Execute method also so i don't think trigger is playing any role in it – Pramod Kumar Jan 20 '15 at 17:33
  • I see you have a callout in execute() -- there is a V32 limit of 100 per execute() -- how big is scope? - By the way, you should do the callout if running testmethods and mock the response - otherwise it will be hard to assert / get code coverage – cropredy Jan 20 '15 at 23:49
  • I have modified the code to avoid doubts. Still i am getting this exception – Pramod Kumar Jan 21 '15 at 5:33

'AsyncApexExecutions Limit Exception' means you are hitting an org wide 24 hour rolling limit on asynchronous Apex.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm "The maximum number of asynchronous Apex method executions (batch Apex, future methods, Queueable Apex, and scheduled Apex) per a 24-hour period: 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater"

Adding the result of these two queries should help you see where you are at:

Integer nonBatchAsyncApexJobs = [SELECT count() FROM AsyncApexJob WHERE JobType != 'BatchApexWorker' AND JobType != 'BatchApex' AND CreatedDate >= :DateTime.now().addDays(-1)];

AggregateResult[] ar = [SELECT SUM(JobItemsProcessed) FROM AsyncApexJob WHERE JobType = 'BatchApex' AND CreatedDate >= :DateTime.now().addDays(-1)];

Integer batchJobItemsProcessed = Integer.valueOf(ar[0].get('expr0'));

Integer total = nonBatchAsyncApexJobs + batchJobItemsProcessed;

System.debug('total: ' + total);

The second query can be especially important because JobItemsProcessed represents the number of batches processed in a BatchApex type AsyncApexJob. Each batch is counted towards the limit and this can add up quickly depending on the run frequency and records processed per batch.


I realize this is an old thread. Putting this here to help others who run into this.

You can use SFDX to check org limits with the following command

sfdx force:limits:api:display -u <username or alias>
  • I just now had a need to do this, and found your post. This is awesome, thanks for posting this! – Florissant53 Jul 26 '19 at 17:03

You can now (as of Spring 19) check the applicable org wide limit directly from Apex:

Map<String,System.OrgLimit> limitsMap = OrgLimits.getMap();
System.OrgLimit asyncLimit = limitsMap.get('DailyAsyncApexExecutions');
System.debug('Usage Value: ' + asyncLimit.getValue() + '/' + asyncLimit.getLimit());

07:31:06:068 USER_DEBUG [6]|DEBUG|Usage Value: 250004/250000

This is the same data that is exposed via the REST Limits resource.


Many, many limits can be found by querying /services/data/v46.0/limits within Workbench's REST Explorer: screenshot of Workbench's Rest Explorer with DailyAsyncApexExecutions expanded

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.