Things to Remember while working with Future Methods:

  1. Future annotation must be static methods and can only return a void type.
  2. The parameter must be primitive data types, arrays of primitive data types, or collections of primitive data types.
  3. Object can not be passed in the parameters of the method as the state of the object can change at the time of method’s execution. But Ids can be passed.
  4. You can’t call a future method from a future method. Nor can you invoke a trigger that calls a future method while running a future method.
  5. It’s not necessary that future methods would execute in the same order they are called for the execution.
  6. Methods with the future annotation can be neither used in Visualforce controllers in either get or set methods, nor in the constructor.
  7. Isolating DML operations on different sObject types to prevent the mixed DML error.
  8. The getContent() and getContentAsPDF() methods can’t be used in methods with the future annotation.
  9. You’re limited to 50 future calls per Apex invocation, and there’s an additional limit on the number of calls in a 24-hour period.
Like it ? Share : Do Nothing

Leave a Reply