Apex Triggers on Change Data Capture Events
In the Summer '19 release, we're very excited about Asynchronous Apex Triggers. This allows you to decouple business logic and heavyweight processing outside of the transaction. What we've done is enabled the case object for Change Data Capture. And we've written this new asynchronous Apex trigger on the case change event itself. This is now going to be executed when these case change events flow through the event bus rather than synchronously inside the transaction on the Case sObject. What we're going to do here is a red account prediction. This process is very limit-intensive, and computationally slow. So, we're going to do this asynchronously, outside the transaction, rather than slowing down the end-user's experience. When this case gets updated, we're going to receive the change event, and predict if this red account is applicable for the account record associated with the case that has just been logged. So, let's do that. We're going to log a case for, "Astro," and it was a phone call with high priority. The part that's failing is the, "GH22." And then, we're going to save that. As you can see, that asynchronous Apex trigger kicked off on that case change event, and predicted that the account, "Astro," may be red. Let's take a look at that. As you can see here, asynchronously, we evaluated that case, and the account status, and determined it was at-risk for an escalation. So, we've updated the rating to red. And now, our service agent can take more direction and action. Also, we've removed that heavyweight calculation outside of the transaction so that all the synchronous processing and transactional logic can happen very quickly. Asynchronous Apex triggers for this release are a very new, exciting enhancement for all those enthusiasts with Apex and Apex triggers.
https://youtu.be/Y_0vejL_wFo














