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
NihanNihan 

why you cannot call future method from batch class as we can do from Queuable class?

Here are my few questions:

1) why you cannot call future method from batch class as we can do from Queable class?
2) Why cant we call future from future?
3) Why future method has to be static?
NagendraNagendra (Salesforce Developers) 
Hi Nihan,

1) Refer below links
  • https://success.salesforce.com/answers?id=9063A000000pNjjQAE
  • https://resources.docs.salesforce.com/194/latest/en-us/sfdc/pdf/salesforce_async_processing.pdf
  • http://www.sfdcstuff.com/2016/10/asynchronous-apex-apex-scheduler-batch.html

2) You cannot call another future method from a future method. As per Salesforce documentation.
You cannot call a method annotated with future from a method that also has the future annotation. Nor can you call a trigger from an annotated method that calls another annotated method.
If you do not have a dependency between f1 & f2, you can call both methods one by one from the original class.

3) So that we can call the method directly by the class name.

Thanks,
Nagendra