"Invoke multiple apex methods" - from single lightning controller method...

by - September 18, 2020


There comes a need to invoke multiple server calls from one JS controller method and also to control the sequence of the execution. If you have already tried this, your first time attempting it might have been a mess.

This can be accomplished by writing the second server call inside the first setCallback method, the third server call inside the second controller setCallback method and so on. Confusing??? Let us look at the code to get a better understanding.

Apex class with three methods - which we want to invoke from the same javascript method on the lightning controller

We have a lightning button on the UI

The JavaScript controller which defines how to invoke the three apex methods from one controller method.



Hope this is useful and if you have doubts, reach out to me through the comments section. I would love to hear you out. Stay safe and happy, until next time :)




We want to hear from you!

0 Comments

Have an idea? Let’s hear it.