Calling future methods
As noted in the previous section, our future method is simply a static method, meaning we can call the method in the same way we would call any static method. For example, imagine our method was defined as follows:
public class FutureClass {
@future
public static void myFutureMethod() {
//Method code
}
} Then, to invoke this method, we would simply execute the following line of code within our code to call the function:
FutureClass.myFutureMethod();
We can call future methods from almost any Apex code we are executing with only a small number of exceptions. You cannot chain future methods together, so the following code would compile but throw an exception when futureB() was invoked:
@future
public static void futureA() {
//Code for futureA method
}
@future
public static void futureB() {
//Execute some other...