Reader small image

You're reading from  Mastering Apex Programming

Product typeBook
Published inNov 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781800200920
Edition1st Edition
Languages
Right arrow
Author (1)
Paul Battisson
Paul Battisson
author image
Paul Battisson

Paul Battisson is the CEO of Groundwork Apps, a Salesforce ISV Partner, a 9- time Salesforce MVP, and a current MVP Hall of Fame member. He has spoken at numerous Salesforce events including Dreamforce, London's Calling, the Salesforce London World Tour, India Dreamin, and DreamOle. He runs the Leeds Developer Group in the UK and the CloudBites TV website and YouTube channel where he helps Salesforce developers, consultants, admins and architects. He is the author of multiple books and training courses on Salesforce programming.
Read more about Paul Battisson

Right arrow

Summary

As we have seen in this chapter, future methods are a versatile and easy-to-work-with asynchronous processing option within Apex. They allow us to define discrete bundles of code that can be used for making long-running callouts or to avoid mixed DML errors when working with setup objects.

We have also seen some different methods of interacting with future methods to persist state and errors between transaction contexts, and finally saw how our future methods can be tested.

The reason we focus on future methods first in this section is that they are the simplest to invoke (just a static method call) and therefore are easier to test. They also have limited out-of-the-box support for state transmission, which has to be mangled through the use of an object that persists across the transaction context.

In the next chapter, we are going to look into batch Apex, where state persistence and use cases differ from what we have seen.

lock icon
The rest of the page is locked
Previous PageNext Chapter
You have been reading a chapter from
Mastering Apex Programming
Published in: Nov 2020Publisher: PacktISBN-13: 9781800200920

Author (1)

author image
Paul Battisson

Paul Battisson is the CEO of Groundwork Apps, a Salesforce ISV Partner, a 9- time Salesforce MVP, and a current MVP Hall of Fame member. He has spoken at numerous Salesforce events including Dreamforce, London's Calling, the Salesforce London World Tour, India Dreamin, and DreamOle. He runs the Leeds Developer Group in the UK and the CloudBites TV website and YouTube channel where he helps Salesforce developers, consultants, admins and architects. He is the author of multiple books and training courses on Salesforce programming.
Read more about Paul Battisson