You need to sign in to do that
Don't have an account?
dJadhav
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
http://boards.developerforce.com/t5/Apex-Code-Development/too-many-callouts-11-and-cannot-bulkify-callouts/td-p/387331
http://boards.developerforce.com/t5/Apex-Code-Development/Too-many-callouts-2-error-with-batch-apex/td-p/153838
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);