identifying users with tasks from a list view

Phil O_shea
Mega Contributor

Hi Friends,

 

On implementation of Snow we leveraged AD as our user provisioning and now planning on switching to an Identity governance app SailPoint to create users within the tool instead....

need a way to cleanup the inherited mess we obtained from AD and identify\delete users that have no associated tasks\links to fields.

 

In Short: i would like to see a task count associated to a user in a list view.

if the user has no tasks assigned to them, then i will be able to identify that at a first glance instead of opening the record.  

 

Phil.

5 REPLIES 5

Aditya Telideva
ServiceNow Employee
ServiceNow Employee

Hi Philip,


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');



Thanks,


Aditya Telidevara