marcguy
ServiceNow Employee

ouch!! I think you will need to do write a gliderecord query to intially go through sys_user and then for each user, look on those tables, I can think of 3 at least but there are bound to me more places, roles, group memberships, etc.




task - assigned_to


cmdb_ci - assigned_to


sysapproval_approver - approver



do a count where you find the user. an example to get started would be this to look for tasks assigned to the user



The script below would take a users sys_id and return how many tasks assigned to them


var task = new GlideAggregate('task');


task.addQuery('assigned_to', 'users sys_id');


task.addAggregate('COUNT');


task.query()


var tickets = 0;


if (task.next())


tickets = task.getAggregate('COUNT');


gs.print('this user has ' + tickets + ' tickets assigned to them');