April 23, 2020

April 23, 2020 | Aaron Pacheco | Technical Solution Architect

Transaction Finalizers Keep the Ball Rolling

If you have ever used the Salesforce queueable interface and wished you could daisy chain actions or react to uncatchable errors, well buckle up, because Salesforce just released a new pilot feature called “Transaction Finalizers,” which enables you to do just that!

The new Transaction Finalizers feature makes it possible to reliably execute additional code after the asynchronous execution of any class that uses the Queueable interface, regardless of whether it succeeds or fails. This will be useful in many ways, the most immediately obvious being for capturing and reporting errors that are otherwise difficult or even impossible to programmatically react to.

Beyond just logging errors, for example, you could schedule further processing for records that were successfully processed or attempt to retry processing for failed records. You could also use it to send an email to help keep track of the job status. Being able to guarantee the execution of code even despite throwing an uncatchable exception is useful in plenty of ways.

An Example for Continued Record Processing

In the tech paper linked below, we’ll be using Transaction Finalizers to make sure that the processing of records continues, even if there is an error. Further, we’ll use the debug log to give our developers more useful information to address the root cause of the failure.

Download the Tech Paper


The new Transaction Finalizers feature has huge potential, especially if it can be expanded beyond just the Queueable context. Being able to react to uncatchable Apex errors or daisy chain your queueable apex will help stabilize all sorts of asynchronous logic. It could also be useful for doing post-processing after triggers have finished running or doing surgical database rollbacks when reacting to partial failures.

I’m very much looking forward to seeing this feature become fully developed and made generally available by Salesforce.

Closing – Aaron Bio

Aaron Pacheco is a Technical Solution Architect with over 8 years of experience on the platform and a long-time lover of technology. When not tinkering with some device or delivering client solutions, he enjoys spending time in the mountains snowboarding, hiking, and riding his bike.

We love designing and delivering complex solutions for Salesforce. Connect with us to learn more about how Spinnaker Support’s managed services can enhance your platform growth.

Powered by Translations.com GlobalLink OneLink SoftwarePowered By OneLink