Skip to Content
Mar 25, 2019 at 10:31 PM

Timeout script not consistent



I have an issue. I added script to timeout for 20sec(for testing, actual timeout is 15min). the script is not consistent. sometimes it is triggering, sometimes not. This script is added under "ENTER" screen event. what is the issue. Please suggest the solution.

var timeout = null;

window.document.body.onkeypress = function(event) {

// Clear the timeout to prevent the previous task from executing


// Do session timeout code here: Only runs if

// inactive for more than specified MS

timeout = window.setTimeout(function () {

session.utils.log("Session timed out!");

session.utils.showOptionDialog("My Dialog", "Session expired! closing the form", session.utils.MESSAGE_TYPE_INFORMATION, //session.utils.MESSAGE_OPTION_OKCANCEL, session.utils.MESSAGE_OPTION_OK, onOptionDialogClose, "1"); }, 20000); };

function onOptionDialogClose(decision, ID)

{ session.findById("wnd[0]/tbar[0]/okcd").text = "/nex"; session.findById("wnd[0]").sendVKey(0); }