What are Feature method Considerations?
Methods with the future annotation must be static methods, and can only return a void type. The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types. Methods with the future annotation cannot take sObjects or objects as arguments.
public static void doCalloutFromFuture() {
//Add code to perform callout
}
- Specify (callout=true) to allow callouts in a future method.
- Specify (callout=false) to prevent a method from making callouts.
public static void doCalloutFromFuture() {
//Add code to perform callout
}
- Remember that any method using the future annotation requires special consideration because the method does not necessarily execute in the same order it is called.
- Methods with the future annotation cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor.
- 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.
0 comments: