You are currently viewing Get Logged-In User Count Into ServiceNow Instance?

Get Logged-In User Count Into ServiceNow Instance?

It is quite common in servicenow to get the list of logged in users into servicenow instance. I got the same requirement for the purpose of a requirement where we have to barred users into instance for some time till the deployment is complete.

So, there are multiple ways to get this information.

First Solution

First one is User Sessions [v_user_session] table

  • The “v_user_session” table dynamically gets populated with the user’s sessions.
  • ServiceNow stores all of its configurations in the database, but logged-in sessions is actually part of the application layer and not the storage layer.
  • As such, it’s reading the logged-in sessions from the Java application. As the applications run on each individual mode and the nodes themselves do not communicate with one another, all the logged-in users in the table show that you are the logged-in user on the application node that you’re on.

Second Solution

  • Go to sys_user_session table-
    • We can get the  ‘current‘ logged-in users from the entire instance, by filtering on “Name is not Empty” AND “Invalidated is Empty“.
    • The sys_user_session.invalidated column will be empty, as long as the related user session is active.
    • When the session becomes inactive (either by logging out, or session being destroyed by the platform – based on the value of ‘glide.ui.session_timeout’ system property), sys_user_session.invalidated will be populated with the session end timestamp.
  • Normally “Logged in users” module under “User Administration” will give you the correct number of users logged in. But when Multi SSO/Single Sign-on is enabled, this module doesn’t show the correct information.

You can find the users logged in by following the steps below:

  1. Go to with include=sessions
    • Example:
  2. In the <sessions> tag
    • logged_in parameter shows how many users are currently logged in to this node.
end footer

Leave a Reply