Get list of users who are in a User Criteria?

stevey
Kilo Contributor

I need a good way to generate a list of users who fall into a particular user criteria. I know you can see the reverse of this, like see the different user criteria a user, or group, or location belongs to. Can anyone think of a good way to do this?

6 REPLIES 6

Jaspal Singh
Mega Patron
Mega Patron

Hi Steve,

 

If the Users are added directly to the User field of the User Criteria then you can report on it directly.

If the User criteria uses some script to check logged in User & then displays required items, articles, etc then there is no option as the script itself runs dyamically so getting the report for case where script controlls the criteria functioning will not be possible.

DirkRedeker
Mega Sage

Hi

Navigate to "> Service Catalog > Catalog Definitions > User Criteria" and set the below shown filter:

find_real_file.png

If you want to see which users are in any given User Criteria, you can just have a look at the "Users" Column of the List.

 

Let me know if that answers your question and mark my answer as correct & helpful, please.

Have fun & BR

Dirk

 

 

DirkRedeker
Mega Sage

Hi

If you want to have a small code-snippet, which you can run in "Scripts - Backgroud" to list the users of each User Criteria, you can take the following as a starting point:

var ucGR = new GlideRecord('user_criteria');

ucGR.query();

while(ucGR.next()) {
  gs.info('User Criteria "' + ucGR.getValue('name') + '"' + ' / Users in this User Criteria: "' + ucGR.getDisplayValue('user') + '"');
}

Let me know if that answers your question and mark my answer as correct & helpful.

BR

Dirk

Hi

Do you have an update on this? Did you manage to solve your issue?

If yes, please mark the best answer as the correct one to close this thread.

Thanks & BR

Dirk