Tracking the Status of Long-Running Apex Methods in LWC
Tracking the Status of Long-Running Apex Methods in LWC
Bapu Rao Srigadde,Bhavitha Guntupalli
TLDR
This research shows how the use of asynchronous methods coupled with real-time progress updates can be a breakthrough to the scalability and user experience of modern Salesforce implementations.
Abstract
Handling timeout or long waiting operations is a major problem that Salesforce Lightning Web Components (LWC) have. In these systems, a long-running Apex operation is usually handled synchronously, which means that the whole workflow is put on hold and the user interface is not updated until the operation has been completed. Hence, the shared user interface sometimes freezes, slows down, or the user is simply "kicked out" due to timeouts and system limits. The present study focuses on creating a real-time communication channel between LWC and Apex whereby standard users are free from waiting and checking the time they can. It is enabled and maintained by a set of the latest Salesforce asynchronous features, such as Platform Events, Queueable Jobs, and the Continuation framework. The case study reveals that LWCs can now listen to server-sent events and reflect the operation statuses without any input from the users, i.e., maintenance and monitoring become invisible. These "background jobs" have reduced the latency that the user is most aware of and thus user satisfaction has been increased significantly. Monitoring completion rates could be increased by as much as 40% just by this method alone, according to the experimental data. This technique serves as a scalable model for complex Salesforce apps and thus is very beneficial in terms of system throughput and dependability. This research shows how the use of asynchronous methods coupled with real-time progress updates can be a breakthrough to the scalability and user experience of modern Salesforce implementations.
