Want to know how Can I know the users who is not a member of any group?

ahmed21
Kilo Expert

Hello ServiceNow community, I have a requirement to know who from the active users we have is not a member of a group with type "ITIL" (Type is an out of the box field on the group table.

we are on Helsinki Patch 11

Thanks a lot.

1 ACCEPTED SOLUTION

Hi Ahmed,




You can pull all users who are not mapped to any group using the following method.




1. Create a script include and place the below function in it.


script:


*************************


find_real_file.png



*****************************



2. Create a report on 'sys_user' table and call the script include function in the report filter. Please refer the below screenshot. On running the report, you'll get the list of users who are not member of any group.




find_real_file.png





Similarly, you can use the below script to fetch the list of users who are member of non ITIL type group.


find_real_file.png



-Udhay


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

22 REPLIES 22

OK let me just confirm, all of your users are in groups and only those in a group with the ITIL role have the ITIL role yes?



If so and the data you are looking for is a list of users who don't have the ITIL role then the original script include i sent on this thread will return you that data.



If not, please clarify your requirement.


Thank you, David,


My requirement is to make sure all the active users we have on the system are a part of a group, and if they are not, I need to target those who are not a part of any group I would prefer if I could even choose the type of group.


Why?


Our approval workflow is built based on the user group (to know the department head,...) from the group that the user belongs to. so I need to make sure all the users belong to a group.


Dave Smith1
ServiceNow Employee
ServiceNow Employee

Our approval workflow is built based on the user group (to know the department head,...) from the group that the user belongs to. so I need to make sure all the users belong to a group.


Erm.. groups or departments?



A user can belong to several groups, but only to one department.


Hi Ahmed,




You can pull all users who are not mapped to any group using the following method.




1. Create a script include and place the below function in it.


script:


*************************


find_real_file.png



*****************************



2. Create a report on 'sys_user' table and call the script include function in the report filter. Please refer the below screenshot. On running the report, you'll get the list of users who are not member of any group.




find_real_file.png





Similarly, you can use the below script to fetch the list of users who are member of non ITIL type group.


find_real_file.png



-Udhay


Please Hit like, Helpful or Correct depending on the impact of the response


Hello Udhay,


I have created the script includes and the report but for some reason, the reports bring back (no records to display) but I'm there are some users without any group.Script inc.pngreport.png


Screenshot attached.