Question


EvonSys
IN
Last activity: 3 May 2016 4:57 EDT
How to close current tab on click of submit in modal dialog?
I have a requirement in which I need to close the current tab on click of a button in the modal dialog.
the below script is working fine in Pega 6 version but does not work in Pega 7
function closeCurrentTab()
{
try{
var confirmId2 = document.getElementById("ConfirmVoid");
if(confirmId2.value!="Reject")
{
if(typeof(event)=="undefined")
event=window.event;
pega.u.d.doModalAction(pega.u.d.submitModalDlgParam,event);
var activeTab=parent.pega.composite.container.tabDisplay.getCurrentTab();
if(activeTab!=null){
parent.pega.composite.container.tabDisplay.closeTab(activeTab);
}
}
else{ pega.u.d.doModalAction(pega.u.d.submitModalDlgParam,event);
}
} catch(err){
} }
Message was edited by: Lochan to add Category
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


Pegasystems Inc.
IN
Hello Abhishek,
can you please elaborate a little that how you are trying to use this code in your modal ?
Also by closing a tab do you mean the parent tab from where you opened the modal or someother tab ?
If it is the parent tab then while closing the tab are you also closing your modal ?


EvonSys
IN
Hi Santanu,
I am running script on click of the button from Actions tab
The parent tab from where the modal is opened.
Yes I am closing the modal as well.


Is it something like on modal submit / cancel, you want to close the current Tab ?


EvonSys
IN
Yes Sathish


Then configure "Cancel" action immediately after the launch modal action in the button. This should take care of closing the tab post modal submission.


EvonSys
IN
Yup. Cancel Works there.
But in Pega 7.1.8, there is a new modal confirmation section"pyDirtyCheckConfirm" which has cancel, discard and save buttons. So, after we configure the cancel on our modal dialog, another modal dialog appears. Here, clicking save does not close the current tab.
Also, if we modify the actions on the save button to include cancel in pyDirtyCheckConfirm, then it will be applicable for the entire application and client side validation will not be fired.


Okay. I get it now. So basically you want to even avoid this dirty check as well.


EvonSys
IN
Yes, I want to bypass the dirty check.


Pegasystems Inc.
IN
Hello Abhishek,
To avoid dirty check on cancel button, place the below script in UserWorkForm rule
<script language="javascript">
pega.u.d.bClientValidforReviewAction = false;
</script>
Best Regards,
Mounika


I usually suggest setting the following boolean to avoid dirty check logic at client side,
pega.u.d.gDirtyOverride = false
This can be done via Run Script action just before the modal launch action (or) can be set for the whole harness by having the above code in a script file and adding the same to harness rule.