Popup notification that user has timed-out

danielcigrang
Kilo Explorer

We are looking to put up a notification to a user to say they have "timed out" and that their session will be refreshed, as they will lose any unsaved changes pending. Is there any way to successfully do this?

 

I have tried to use the method similar to two users editing a change/incident ticket, one user saves their version and pops up a "Simultaneous Update Alert" to the other user noting that someone else has edited that ticket while they have been on it.

 

Looking to do this when their session has ended and to say that they will lose their changes.

3 REPLIES 3

conmic
Mega Guru

You need to create a business rule and run it with a scheduled job. There are two values that you need, however for the second one, I have no clue how to get it:



1st.: the default session timeout is defined in "glide.ui.session_timeout"


Source: https://wiki.servicenow.com/index.php?title=Modifying_Session_Timeout


so you would call that property with gs.getProperty and store the value into a variable.



2nd.: you would need to get the users current session time... there is a GliseSystem function gs.getSession(), but it's poorly document. Perhaps you can find somewhere if it's possible to call the users last transaction or inactive time. Worst case you have to contact SN if they can help you out with that.


Update: I have extracted a list of the methods (properties), but nothing seems to fit...


I guess your closest call is using the last transaction time on 'logged in users'



however, if you're still interested in the available methods of gs.getSession(), here they are:



getSessionID,enableDomain,getFullName,hashCode,setLanguage,
onlineImpersonate,getReturn,isUpdateSynchSuppressed,notifyAll,getImageCache,getLoginHome,
setDomainID,clearBusinessRuleStack,startTransaction,hasNamedMessages,
getTimeZone,addUniqueInfoMessage,addMessage,equals,getCurrentDomainID,getURI,
clearActiveDBs,setSeparation,setCategoryParm,getUserName,getLanguage,
clearWatchField,getRoles,getIntProperty,getCategoryParm,loadUserByID,toString,
getBusinessRuleStack,setStrictQuery,getClass,notify,setUser,clearCategoryParm,
getUserDisplayName,isLockedOut,clearProperty,setURI,setCacheIgnoreFlushTable,
addNotification,getSessionWrites,getDateFormat,forgetHeldMutex,getTimeFormat,
resetURI,setRedirect,getBusinessRuleExceptionHandler,setCacheFlush,clearClientData,
getStackParms,addUniqueMessage,getDomainEnabled,setWatchField,getInfoMessages,
getRedirect,getActivatedElevatedRoles,setBusinessRuleExceptionHandler,
impersonate,setInteractive,getErrorMessages,setLoggedIn,checkActiveDBs,
getAvailableElevatedRoles,setWorkflowDisabled,getNamedMessages,
getImpersonatingUserDisplayName,setRunEngines,getTimeZoneName,
setDomainEnabled,flushMessages,getUser,getProperty,addAdminLevelErrorMessage,
setWorkflow,setBrowserLocale,getOpticsContext,holdsMutex,hasRole,
getSessionKey,getClientDataMap,setTimeZoneName,setStackParm,getWorkflow,
renameStack,getHttpSession,impersonateWithDefault,isLoggedIn,wait,clearOpticsContext,
getTrivialMessages,getEncryptionContext,establishSession,
valueUnbound,rememberHeldMutex,setClientIP,getStacks,getImpersonatingUserName,
getCacheFlush,getDateTimeFormat,isInteractive,getCategoryParms,
setLastUser,getStack,setHttpSession,getWatchField,addTrivialMessage,connectionStatus,
putProperty,getClientIP,getRunEngines,getStackName,getLastUser,
getStackParm,separationEnabled,setDateFormat,setSessionID,getUID,clearCategoryParms,
addErrorMessage,addInfoMessage,getClientData,suppressUpdateSynch,
onlineUnimpersonate,setTimeFormat,getCacheIgnoreFlushTable,setReturn,putClientData,
getBooleanProperty,getCurrentDomain,valueBound,getStrictQuery


indira_iyer
Kilo Explorer

Hi Daniel, have you been able to implement this? If yes, could you please share it? I have received a similar request from my customer.