Challenges with Retrieving Users with Active Sessions in ServiceNow Scoped Applications

DaminiD
Tera Contributor

Hey folks,

I'm currently tackling the challenge of fetching users with active sessions in my ServiceNow instance. So far, I've tried a few methods, but each has its limitations:

1. Querying `v_session_user` table: This approach only fetches users with active sessions on one node, missing users on other nodes.

2. Querying `sys_user_session_list` table: While this table contains session information, it restricts cross-scoped privilege access, which isn't ideal for my scoped application.

3. Querying `sysevent` table: Unfortunately, this table is off-limits for querying unless you're working within ServiceNow-authored scopes.

4. Using `GlideSession()` object: Attempting to use this throws an error in custom scoped applications.


I'm reaching out to see if anyone has encountered similar challenges and found alternative solutions for fetching users with active sessions. Any insights or suggestions would be greatly appreciated!

1 REPLY 1

The Machine
Kilo Sage

Have you tried creating a global script include and making it available to all scopes?

Another option that I use a lot is the Table API.  This bypasses some of the scoped issues you might have when trying to retrieve data from some of these system tables.

Hopefully that helps.  Good luck 🙂