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

Batch-Process Builder-Invocable Method-Webservice Callout Fails

Hi All,

I have a batch which processes bulk records. Once records are updated, I am firing up a process builder to invoke apex method making a webservice callout. As the context is batch, I can not use @future annotation. So it fails with error "System.CalloutException: Callout from triggers are currently not supported."
If I call webservice callout method directly in batch, then I might hit callout limit. I am kind of stuck with this situation. Any solution will be appreciated. 
Limit batch size to small number and you should be able to run.
Also you can send bulk records in callout if your webservice supports. I did one batch with 10 records per call out and ran for 2000 records with batch size as 10.

execute method:
for (sObject row:scope) {
    fetch row and add to list
Callout with row list (my webservice supports mutliple records and we are sending 10 rows. Ran into timeout errors when sending more than 10, so we decided to go with 10).

If your webservice accepts only 1, then you need to set your batch size as 1.

Database.executeBatch(classinstance, 10 or 1);