So, the easiest way to implement showing a spinner in a dynamic action is as follows.
Dynamic Action
1. Execute JavaScript Code
popup = apex.widget.waitPopup();
2. Execute Server-side Code
--your PL/SQL code
3. Execute JavaScript Code
popup.remove();
Let’s implement it in Apex. I created a button called btnRun and now it’s time to set up the dynamic action.

Step 1) Execute JavaScript Code

Step 2) Execute Server-side Code

Step 3) Execute JavaScript Code

I hope this helps 🙂
Thank you for your sharing, it is really good solution
Can you explain why it must be “popup = apex.widget.waitPopup();”? I noticed that if I put “var popup = apex.widget.waitPopup();” I get an exception about “popup” not being defined. I don’t understand what “popup” is. Is it defined on the page by default in APEX?
Hello Jared,
No, the popup variable is not defined by default. You can declare it in the Function and Global Variable Declaration section to make it globally accessible. However, if you declare it within a Dynamic Action, its scope is limited to that specific block of JavaScript, meaning you won’t be able to access it later via the browser’s console or other scripts.
Tk so much.