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
rscottrscott 

Batch Apex governor limits - callouts

We have a need to update an external system (through web service callouts) based on actions inside Salesforce. In order to limit the number of updates, we thought we could combine some updates together and use batch Apex. Unfortunately, there appears to be a limit in the number of callouts in batch Apex of one (1). The batch apex documentation states that it "uses the standard governor limits anonymous block, Visualforce controller, or WSDL method" which would give a limit of 10 callouts. This does not appear to be the case and the limit of 1 effectively forces a (fairly useless) max batch size of 1 in order to guarantee not hitting it. Has anyone hit this limit and used a different approach?

 

Also, does anyone know if there is a governor limit on the total number of callouts per day? I can't seem to find one in the docs.

 

Thanks,

 

Rob 

trekbintrekbin

I think you just have to  make your Batchable class implement Database.AllowsCallout

 

Let me know how it goes.

 

-Santosh Prasad

 Co-Founder, Trekbin

+1 (646) 652-6836

 

 

rscottrscott

If you don't make your class implement Database.AllowsCallouts, you can't make any callouts. If you do, you only get one.

 

I did some testing and there does not appear to be any limit on callouts other than the per transaction one.

trekbintrekbin
That's true. The per transaction - 1 is kind of really strange though.
Scott.MScott.M

If you set the batch scope to one it seems like you could technically do up to 50 000 000 callouts in a batch, one per record. Something tells me there's a limit though but I can't find what the daily callout limit is.