Need a common Portal page that always reloads/refreshes so we can display an idle session timeout

Matt S6
Tera Contributor

We have received feedback from our users that when using ServiceNow's portal (Employee Center), if the session times out, the site may appear "dead" to the user (e.g. typing in search box does nothing). If the user clicks a link or refreshes the page, they are re-authenticated automatically through SSO. Unfortunately, we get enough user feedback (5-10 users per week) that we decided to implement an idle session dialogue. In the Next Experience UI, this already occurs, but does not in Portal.

 

I created a widget containing a modal, and placed it in the header at first. Unfortunately this causes the modal to seize the entire screen, including the modal itself. I moved the widget to the footer, and this works great, EXCEPT...

 

The footer doesn't refresh/reload as the user clicks around the portal site.

 

The way I built this was simple. When the widget loads, a 60-minute countdown starts. When the countdown hits zero, the modal dialogue appears, and the user clicks the Refresh button, reauthenticating through SSO and avoiding the "dead site" experience.

MattS6_0-1683591337278.png

 

 

The thought was that as the user clicks around the site, the footer would reload/refresh and the counter would start over. As long as the user was active, the counter wouldn't reach zero. But the footer doesn't actually reload, so the user will receive the timeout message even if they're very active on the site.

 

The Portal header and footer are "common" components. No matter what page the user loads in the portal site, those are always present, making them seem to be ideal to put a session timeout widget. However, I need a common component/page that always refreshes as the user navigates the site. The only other alternative is to embed the timeout widget on every single page in our portal.

 

Is anyone able to suggest a good place to tuck such a widget?

 

If your thought is to have a widget periodically "ping" the server, that won't work, as the session would stay alive indefinitely and our information security team won't allow that. Sessions need to expire after 60 minutes of inactivity.

6 REPLIES 6

surajp
Mega Guru

Hi @Matt S6 

 

v_user_session table will have current logged users session details, you can put a recordWatch on this table with filter to watch current user session record and if last_trasaction_time field changes then reset the timer accordingly.

 

Regards,

Suraj

Matt S6
Tera Contributor

Hi @surajp 

 

I believe to query the v_user_session table it would result in a server call, thereby refreshing the session on the server side and never resulting in a timeout. This needs to be purely client side.

 

Kindest regards,

Matt