Activity › Forums › Salesforce® Discussions › Explain few considerations for @Future annotation in Salesforce Apex.
Tagged: Constructor, Future Annotation, Limits, Methods in Salesforce, Salesforce Apex, Salesforce Jobs, Salesforce sObject, Test Class
-
Explain few considerations for @Future annotation in Salesforce Apex.
Posted by Aman on September 22, 2018 at 6:29 PMExplain few considerations for @Future annotation in Salesforce Apex.
Parul replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Method must be static
Cannot return anything ( Only Void )
To test @future methods, you should use startTest and stopTest to make it synchromouse inside Test class.
Parameter to @future method can only be primitive or collection of primitive data type.
Cannot be used inside VF in Constructor, Set or Get methods.
@future method cannot call other @future method. - [adinserter block='9']
-
NOTE :-
1) Methods with the future annotation must be static methods
2) can only return a void type
3) The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types
4) Methods with the future annotation cannot take sObjects or objects as arguments.
5) You can invoke future methods the same way you invoke any other method. However, a future method can’t invoke another future method
6) No more than 50 method calls per Apex invocation
7) Asynchronous calls, such as @future or executeBatch, called in a startTest, stopTest block, do not count against your limits for the number of queued jobs
8) The maximum number of future method invocations per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater
Log In to reply.