The problem with triggers in most database environments is the save of the record cannot happen until the trigger completes. Synchronous triggers must wait until all the events process whereas asynchronous just initiates the request. Like other valid uses for async, it is when you can do fire-and-forget processing is appropriate. This is when you need some action to happen but it does not need to happen immediately and is not a requirement for the record action to complete. In otherw words, I am creating a new Task when an Opportunity is closed. I want the Opportunity to close but at some point later in the day, I want to end up with a follow-up Task to do something later. Therefore, in my trigger I could make a call to a future Apex to do the creation of the Tasks.
Please find the difference between synchronous and asynchronous trigger below.
Synchronous triggers must complete before further operations can continue. They are typically run when the event is initiated but before it finishes. The event completion is dependent on their success. Triggers are run synchronously by default.
Asynchronous triggers run in the background, independent of other operations that follow. They are typically run after an event completes. To run an asynchronous trigger, the async: prefix must be used.
Here is an example where a Perl email assignment trigger is declared: async:perl crAssignEmail.pl
please mark my solution as best answer if it helps you.
Please find the difference between synchronous and asynchronous trigger below.
Synchronous triggers must complete before further operations can continue. They are typically run when the event is initiated but before it finishes. The event completion is dependent on their success. Triggers are run synchronously by default.
Asynchronous triggers run in the background, independent of other operations that follow. They are typically run after an event completes. To run an asynchronous trigger, the async: prefix must be used.
Here is an example where a Perl email assignment trigger is declared:
async:perl crAssignEmail.pl
please mark my solution as best answer if it helps you.
Best Regards,
Nagendra.P
https://crazy4salesforce.wordpress.com/2019/06/24/summer-19-what-are-asynchronous-apex-triggers-how-are-they-different-from-future-method-or-queuable-interface/