O'Reilly logo

Mastering Application Development with Force.com by Kevin J. Poorman

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

Knowing when to use what

Asynchronous Apex, in its various forms, is incredibly useful. By trading synchronous execution of your code for relaxed or reset governor limits, you can process massive numbers of records, call out to web services without holding up your users, and, as of the Spring '15 release, you can even write fault tolerant asynchronous callouts. Knowing when to use which type of Asynchronous Apex, however, can be difficult. With that in mind, here are some guidelines:

  • If you are manipulating more than 2000 records, use Batchable Apex.
  • While you can directly schedule Batchable Apex, it is almost always preferable to wrap the batch Apex execution in a scheduled class, as this provides much more flexibility regarding execution time ...

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