Activity Forums Salesforce® Discussions Can I make Callout from Batch Classes? Is there is any number of limit in Salesforce?

  • Saurabh

    April 10, 2017 at 2:18 pm

    Hi Suraj

    Yes, you can make from Batch Classes.

    First, you can't call a future method from a Batch class.  My guess is that the threads generated from batches are considered "future" methods, so trying to do it results in the "Future method cannot be called from a future method" error. So, I removed the future designation from the HTTP callout class.

    But what got it for me was making sure to pass the optional scope parameter when my schedulable class calls the batch.  Otherwise, I hit the wall for callout limits.

    So this:



    database.executebatch(b, 1);

    And now the scheduled job runs perfectly, just as if I had manually run it myself.

    It's per each call of execute() in the batch, so for each "batch", you can call up to 10 HTTP callouts.

    If the callout can handle multiple records at a time, do so, and batch up to 10 callouts per batch, otherwise, set the batch scope to 1, so each apex batch handles one record at a time.

    Hope it may help you:

  • Avnish Yadav

    September 29, 2018 at 8:19 pm

    Hi Suraj

    Yes you can make from Batch Classes.


Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Salesforce Integration Tutorial | Integrate Salesforce with Apps

Video in

This "𝐒𝐚𝐥𝐞𝐬𝐟𝐨𝐫𝐜𝐞 𝐈𝐧𝐭𝐞𝐠𝐫𝐚𝐭𝐢𝐨𝐧 𝐓𝐮𝐭𝐨𝐫𝐢𝐚𝐥" video by Edureka will help you understand what is Salesforce integration in detail. It will also address the various Salesforce integration…