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
dJadhavdJadhav 

Getting System.LimitException: Too many callouts: 11

Hi,

 

In my application, I am writing the apex scheduler to get the details of WebEx Event. For each event, I have 2 callouts (GetEvent and LsteventattendeeHistory). I have written my code inside @future annotation. After the fetching the details for 5 events, I am getting the  exception: System.LimitException: Too many callouts: 11

 

Could you please help me to resolve this issue ?

 

 

Thank you,

Dipak

Mayank_JoshiMayank_Joshi
I had a similar situation for sending more than 10 records using batch apex . Finally , I resolved this issue and now batch is successfully processing 'n' number of records in Outbound Callouts .

Here Few things need to be focused :

1 : global class Send_closed_CA implements Database.Batchable<Sobject>, Database.AllowsCallouts{ }

Always required - Database.AllowsCallouts while implementing batch for outbound callouts .

2: Next , most Important . As per documentation Batch Apex can process 200 Records per batch . But , while making callouts Batch Apex can only process 1 record per batch(as per documentation) .To overcome this ,we have to make scope of 1 within a batch .

That means , if we are going to send(outbound ) for any no. of records per batch then scope defined for this should be only - One (1) .

Note - we have to manually set Scope for batch, if there is need to set batch other than 200 . But , scope should only be in range of 1- 199 .

Eg . for executing batch apex code for Outbound callouts with scope defined as One .
Batch_closed_ca batchapex = new Batch_closed_ca();

// Defining scope for the batch ...
id batchprocessid = Database.executebatch(batchapex,1);
system.debug('Process_ID: ' + batchprocessid);