O'Reilly logo

The Developer’s Guide to the Force.com Platform by Phil Choi, Andrew Fawcett, Glen Martin, Rick Greenwald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Future

Apex code supports annotations that influence the way code runs. An annotation is preceded by the ’@’ sign and is added right before the method that is affected by the annotation.

One particularly significant annotation is future. When you use this annotation, the following method is executed asynchronously. Asynchronous execution means that the method executes when the Force Platform has available resources. Control is immediately returned to the module calling the future method.

Methods with the future annotation have to be declared as static and must not return a value. For instance, the following is a valid declaration:

@future
Static void futureMethod() {
 code_block;
 }

The future annotation is ideal for use with web service callouts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required