Question

Customize Dynamic Container's "Close this Tab" option

In our portal we are using Dynamic Container to have the multi tab functionality. Our requirement is that whenever user wants to close any tab (using 'x' mark in the tab) , they should be given some custom messages in modal window. The custom messages should be in a popup (after clicking the 'x' in the tab) and it is different for different work types.

For ex., Case type 1 will be modal dialog with message " The enrollment process is not complete, and your work will not be saved". Case type 2 will have modal dialog with message "rates may change depending on the date the group. Save your work" and so on

Please provide suggestions on how to achieve this.

***Moderator Edit-Vidyaranjan: Updated Platform Capability & Updated SR details***

Group Tags

Comments

Keep up to date on this post and subscribe to comments

Pega
November 11, 2019 - 12:46pm

 

Explore this approach -

Research pageHide/OnUnload/OnBeforeUnload events on JS forums and apply what works for you. We used the pageHide event in one of our cases in UserWorkForm

<script>
    function pageHiddenFunctionName(evt)
    {
                /* put all your custom code before closing the document */

                 pega.desktop.closeCurrentWorkItem();
    }
window.addEventListener("pagehide", pageHiddenFunctionName, false);
</script>

The other approach would  be to

1. Do this

https://community1.pega.com/community/pega-support/question/disable-dynamic-containers-close-tab-option

2. Then configure a button on your harness to call your own actions/scripts before you actually close the button.

Please continue to use the community to discuss pros and cons with any of the approaches and more opinions from member here. Good luck!

 

 

November 18, 2019 - 10:56am
Response to Sunny_GCS

Thanks for your reply. Both the options suggest that we hide the close mark and provide custom button in harness. We tried that approach and it works. However business wants to retain the close mark and provide custom messages in the popup (something like pyDirtyCheckConfirm). Is there way to achieve this functionality?