Async execution options in Apex
In this section, we will do a brief review of the options available in the Salesforce platform itself for running code asynchronously. These can come in handy when you need to do a long-running operation inside a Remote Action or when you need to do some work outside of the OmniStudio framework, and in many other cases, thus allowing your business users to continue using the app without having to wait for operations to complete.
Apex @future annotation
The Apex @future annotation is a quick way to run a method asynchronously without delaying an Apex transaction. This is also great for making Web Service callouts, separating DML statements, and preventing mixed save DML errors, just like we did with the Chain On Step Integration Procedure setting earlier in this chapter.
To get an Apex method to run asynchronously, simply add the @future
annotation before the method, as shown in the following screenshot:
Figure 6.12...