I’m having a problem with a Pega application. When I’m in a stage and perform actions, then click “Cancel,” a popup appears with “Unsaved changes” and “Cancel” and “OK” buttons. My goal is for the “OK” button to redirect to the homepage.
I’ve configured the “OK” button action to be a “Landing Page” display, specifying the appropriate Name, Class, and Harness Name. I also have a separate “Cancel” action.
However, when I click “OK,” the popup doesn’t close, and the landing page appears behind the current case (within the pre-built case’s frame, I presume). The popup remains open, blocking interaction with the landing page.
How can I resolve this issue so that clicking “OK” closes the popup and redirects the user to the specified landing page?
Updated JavaScript Function
How to Use in Pega Action:
- In the OK button actions, add:
- Run Script
- Function Name:
closeModalCancelCaseAndNavigate
- Parameters:
"YourClassName"
(replace with actual class name)"YourHarnessName"
(replace with actual harness name)
- Function Name:
- Run Script
Alternative Approach (Using Only Run Script in Action)
If you prefer not to create a separate script file, you can directly add this in the Run Script action:
This ensures: ✅ Modal Closes
✅ Case Cancels
✅ Redirects to Landing Page
Let me know if you need further adjustments!