Activity Forums Salesforce® Discussions Can we call a Future method from Salesforce batch class?

  • Prachi

    Member
    August 8, 2018 at 7:13 am

    Hello Avnish,

    Salesforce doesn't allow a future method to be called from another future method or a batch job.

    While @Future cannot be called from a batch class, a webservice can. A webservice can also call an @future method. So have your batch class call an apex webservice that in turn calls your @future method.

    Thanks.

  • shariq

    Member
    September 16, 2018 at 5:26 pm

    Hi,

    To make it more simple -

    You can't call asynchronous method from another asynchronous method.

    Hope this helps.

  • Parul

    Member
    September 16, 2018 at 5:34 pm

    No You can not because batch class is a Synchronous process and @ future is Asynchronous.

     

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos