A simple way to track real user activity in ServiceNow
Why I built this
If you have ever reviewed your ITIL subscription and wondered, “How many users actually use this?” you are not alone. Subscriptions can be costly, and renewal discussions often rely on assumptions or static reports that do not reflect real usage.
One of the organisations I worked with needed a simple way to track which ITIL users were actually active, not just assigned a role but logging in and using the back end as fulfillers, agents, or however your team defines it. The goal was to support monthly subscription reviews, identify inactive ITIL users, and make informed decisions about group membership and assignment strategy.
I needed something lightweight, accurate, and easy to automate. A solution that could show who was creating, updating, or touching records within the last 90 days, using only existing ServiceNow data and no extra plugins or cost.
So I built a script that tracks ITIL user activity using the platform’s audit records and turns them into clear, actionable insights.
What this does
The script collects every user with the ITIL role, checks when they last worked on a record in the tables you care about (i.e. incident, problem, request, change, sc_task), and saves the result in a lightweight custom table. From there, you can easily filter for users who have been inactive for the past 30, 60, or 90 days.
This helps you:
- Identify inactive ITIL users before renewals
- Make informed decisions about subscription usage
- Back up your reviews with actual activity data
Note: This solution is not meant to replace official license auditing or tracking tools. It provides visibility for governance and cost management.
How it works
- Start fresh
The script clears the activity table before each run to ensure clean data. - Find ITIL users
It gathers all users assigned the ITIL role fromsys_user_has_roleand removes duplicates. - Check recent activity
For each user, it searches thesys_audittable for the most recent record across a list of tables defined in a system property. - Store the results
Each user’s name and latest activity date are stored in a custom table calledu_itil_user_activity.
Configuration
System Propertyitil.user.activity.tables – a comma-separated list of tables to include
Example: incident,task,problem,change_request
Custom Table: u_itil_user_activity
u_user(Reference tosys_user)u_last_activity(Date/Time)
You can also add optional fields like department or manager for better reporting.
var gr = new GlideRecord("u_itil_user_activity");
gr.deleteMultiple();
// Collect all ITIL users and remove duplicates
var itilUsers = [];
var roleQuery = new GlideRecord("sys_user_has_role");
roleQuery.addQuery("role.name", "itil");
roleQuery.query();
while (roleQuery.next()) {
itilUsers.push(roleQuery.user.user_name.toString() + ',' + roleQuery.user.sys_id.toString());
}
var noDupesItilUsers = checkDuplicates(itilUsers);
// Check activity for each ITIL user
for (var i = 0; i < noDupesItilUsers.length; i++) {
var tableList = gs.getProperty("itil.user.activity.tables");
var tables = tableList.split(",");
var audit = new GlideRecord("sys_audit");
audit.addQuery("user", noDupesItilUsers[i].split(',')[0]);
for (var j = 0; j < tables.length; j++) {
if (j == 0)
var grOR = audit.addQuery('tablename', tables[j]);
else
grOR.addOrCondition('tablename', tables[j]);
}
audit.orderByDesc('sys_created_on');
audit.setLimit(1);
audit.query();
var ITILact = new GlideRecord('u_itil_user_activity');
ITILact.initialize();
ITILact.u_user = noDupesItilUsers[i].split(',')[1];
if (audit.next()) {
ITILact.u_last_activity = audit.sys_created_on;
}
ITILact.insert();
}
function checkDuplicates(a) {
var r = [];
o: for (var i = 0, n = a.length; i < n; i++) {
for (var x = 0, y = r.length; x < y; x++) {
if (r[x] == a[i]) {
continue o;
}
}
r[r.length] = a[i];
}
return r;
}
Reporting ideas
Once the data is populated, create a simple report that shows:
- ITIL users with no activity in the last 90 days
- Top active users based on last update
- License usage trends if you schedule the script weekly
You can export the table to Excel or add it to your ServiceNow dashboard to make it part of your governance view.
Benefits
- Reveals inactive ITIL users and saves subscription costs
- Makes subscription reviews data-driven
- Uses only native ServiceNow features
- Simple to maintain and extend
Limitations
- Only tracks actions recorded in
sys_audit - Only checks tables defined in your property
- Not an alternative to official license measurement
Final thoughts
This is a quick, practical way to see who is really using an ITIL subscription. With a small script and a few configuration steps, you can turn your audit data into insight and potentially free up unused subscriptions before your next renewal.


Leave a Reply