Activity Forums Salesforce® Discussions Explain few considerations for @Future annotation in Salesforce Apex.

  • shariq

    Member
    September 22, 2018 at 6:29 pm

    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.

  • Parul

    Member
    September 23, 2018 at 6:06 am

    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.

Popular Salesforce Blogs

Popular Salesforce Videos