Support Article
pxSessionTimer logoff timer does not display countdown window
SA-10028
Summary
Post upgrade from Pega 6.3 SP1 to Pega 7.1.7, the pxSessionTimer does not display the pop-up countdown window. User launches CPM Portal and waits for time-out to occur, however the expected pop-up window does not appear. This functionality worked fine in Pega 6.3 SP1.
Error Messages
Not Applicable
Steps to Reproduce
Launch CPM Portal to observe that the time-out window does not display.
Root Cause
This is a known issue with logoff timer in Pega 7.1.7. This is scheduled to be resolved in Pega 7.1.8 but easy to implement in Pega 7.1.7 as well.
Resolution
To use the Logoff Timer in Pega 7.1.7 follow the below steps:
1. Copy pxSessionTimer and rename to SessionTimer<ProjectName>.
2. Place the following script at the bottom of the existing <script> block just before the </script> tag.
function desktop_restartTimeoutWarningTimer(){
if (pega.desktop.TimeoutTime && pega.desktop.TimeoutTime > 0) {
var nTimeoutWarningTime= (pega.desktop.TimeoutTime - pega.desktop.TimeoutWarningWindow) * 60000;
clearTimeout(pega.desktop.TimeoutWarningCountdown);
if (nTimeoutWarningTime >= 0) {
pega.desktop.TimeoutWarningCountdown = self.setTimeout("desktop_showTimeoutLogoffDialogNew('"+pega.desktop.TimeoutWarningWindow+"')",nTimeoutWarningTime);
}
}
}
function desktop_showTimeoutLogoffDialogNew(strTime) {
var iTime = parseInt(strTime);
iTime = iTime * 60000;
var oSafeURL = new SafeURL("@baseclass.ShowLogoffTimer");
oSafeURL.put("time",iTime);
pega.openUrlInModal.showModalDialog(oSafeURL,iTime, 210, 620, function(ret){
if (ret == null || ret == "ok") {
desktop_restartTimeoutWarningTimer();
} else {
pega.u.d.gDirtyOverride = false;
try {
application.logOff(true);
} catch(e) {
pega.u.d.replace('pyActivity=LogOff&pzPrimaryPageName=pyDisplayHarness', null);
}
}
});
}
3. Copy the activity ShowLogoffTimer into your application ruleset (into same ruleset where you put SessionTimer<ProjectName>).
4. Copy and rename LogoffTimer HTML rule to LogoffTimer<ProjectName> (Found in Step1 of ShowLogoffTimer)
<HTML>
<Title><pega:lookup property=".pyMessageLabel" value="Log off timeout warning" /> </Title>
<pega:include name="DesktopStyles" />
<script>
var iTime;
function init() {
window.focus();
window.returnValue = "ok";
iTime = parseInt(window.dialogArguments);
window.setTimeout("closeMe()", iTime);
setTime();
}
function closeMe() {
window.returnValue="timeout";
if(typeof window.closeModal == 'function') { window.closeModal(); } else { window.close(); }
}
function setTime() {
var numSec = iTime / 1000;
numSec--;
var min = Math.floor(numSec / 60);
var sec = numSec % 60
if (sec <= 9) {
sec = "0" + sec;
}
if (document.all){
document.all('_minutes').innerText = min;
document.all('_seconds').innerText = sec;
}
else{
document.all('_minutes').textContent= min;
document.all('_seconds').textContent= sec;
}
iTime = iTime - 1000;
window.setTimeout("setTime()",1000);
}
</script>
<body onload="init()">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- dialog header -->
<td valign="top" class="dialogHeaderBackground" id="topBanner" height="15%"> <table border="0" cellspacing="0" cellpadding="5">
<tr>
<td><TABLE>
<TR>
<!-- Dialog image goes here, use a style to contain the image, add to desktopbase and other style sheets -->
<TD valign="top" nowrap><span class="iconDialogSetWatch"> </span></TD>
<TD nowrap> </TD>
<TD valign="top" nowrap> <table border="0" cellpadding="2" cellspacing="0">
<TR>
<TD NOWRAP="NOWRAP" class="dialogHeaderLabel"><pega:lookup property=".pyMessageLabel" value="Log off timeout warning" /> </TD>
<TD NOWRAP="NOWRAP" cLASS="dialogHeaderData"> </TD>
<td NOWRAP="NOWRAP"> </td>
<TD NOWRAP="NOWRAP" class="dialogHeaderLabel"> </TD>
<TD NOWRAP="NOWRAP" CLASS="dialogHeaderData"></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></td>
</tr>
</table></td>
<!-- end of dialog header -->
</tr>
<tr>
<td valign="top" height="85%"><div class="dialogDataContainer" id="scrollingDIV">
<!-- body of dialog -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table width="100%" cellpadding="0" cellspacing="0">
<TR>
<td align="center" width="76%" CLASS="dialogSubHeaderBackground"> </td>
</TR>
<TR>
<TD valign="top" align="center"> <TABLE border="0" CELLPADDING="0" CELLSPACING="2">
<TR>
<TD NOWRAP="NOWRAP" class="dialogLabelStyle" align="center"> <div><pega:lookup property=".pyMessageLabel" value="Timeout will occur in" /> </div></TD>
</TR>
<TR>
<TD NOWRAP="NOWRAP" class="dialogLabelStyle" align="center"><h2><span id="_minutes"> </span>:<span id="_seconds"> </span></h2></TD>
</TR>
<TR>
<TD NOWRAP="NOWRAP" class="dialogLabelStyle" align="center"><pega:include name="LogoutTimerMessage" /></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD valign="top"> </TD>
</TR>
</TABLE></td>
</tr>
</table>
</div></td>
<!-- end of body of dialog -->
</tr>
<tr>
<!-- dialog buttons -->
<td align="center" class="dialogButtonBarContainer" id="buttonBar">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td nowrap="nowrap" align="center">
<button title='Close this window' onclick="if(typeof window.closeModal == 'function') { window.closeModal(); } else { window.close(); }"
class="littleButton" id="button1" name="button1"> <span class="buttonLeft"></span>
<span class="buttonMiddle"> <span class="buttonText" onmouseout="this.className='buttonText'" onmouseover="this.className='buttonTextHover'">
Ok </span> </span> <span class="buttonRight"></span>
</button></td>
</tr>
</table></td>
<!-- end of dialog buttons -->
</tr>
</table>
</body>
</HTML>
5. In Step1 of ShowLogoffTimer use LogoffTimer<ProjectName> HTML rule.
Placement of SessionTimer in Pega 7.1.7
If you need the new SessionTimer in the portal header, the section needs to be placed at bottom of the portal header. Drag and drop a section from "Layout" in design view and select your SessionTimer<ProjectName>. Configure parameters as required.
Published June 12, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.