Activity › Forums › Salesforce® Discussions › What is the difference between future apex and batch apex in Salesforce?
Tagged: Future Apex, Future Method, Salesforce Apex Class, Salesforce Apex Code, Salesforce Batch Apex
-
What is the difference between future apex and batch apex in Salesforce?
Posted by Anurag algoworks on July 3, 2018 at 12:42 PMWhat is the difference between future apex and batch apex in Salesforce?
Parul replied 7 years, 8 months ago 3 Members · 2 Replies -
2 Replies
-
Future Annotation is used to separate methods that are to be executed asynchronously.If Future Annotation is not used in a web service callout, the thread will wait until the response comes and other processes will not be executed.
Batch Apex is used to separate tasks that are going to handle more records in background process. Batch Apex also runs asynchronously.If Batch Apex is not used for handling bulk records, we will hit governor limits set by Salesforce.com.
- [adinserter block='9']
-
Hi Anurag,
Batch Apex:
Batch apex allows you to define a job that can be divided into manageable chunks, where each chunk can be proceed separately.
In batch apex, it will fetch all records which you want perform the field update and divide them into list of 200 records and every 200 records operation is performed separately.
Batch Apex is exposed as an interface that must be implemented by the developer. Batch jobs can be programmatically invoked at runtime using Apex.
Batch jobs can also be programmatically scheduled to run at specific times using the Apex Scheduler, or scheduled using the Schedule Apex page in the Salesforce user interface.
Batch Apex is used to separate tasks that are going to handle more records(complex long running jobs) in background process. Batch Apex also runs asynchronously.
If Batch Apex is not used for handling bulk records, we will hit governor limits set by Salesforce.com.Future Annotation: @future
Future Annotation is used to separate methods that are to be executed asynchronously.
If Future Annotation is not used in a web service callout, the thread will wait until the response comes and other processes will not be executed.Thanks.
Log In to reply.