How to select only users of a specific group into a reference field

RudhraKAM
Tera Guru

I am trying to show users from 2 groups for a reference field , Came across this article which is working If I use sys_id of one group but not working when used 2 groups , What am i doing wrong 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0831564

 

javascript:'active=true^sys_idIN'+getIDs("74b1b52d1b4bdd10320c535b234bcb1f","fcb1b52d1b4bdd10320c535b234bcb12"); function getIDs(grp){var m=GlideUserGroup.getMembers(grp);var ids=''; while (m.next()){ids+= (m.user+',');} return ids;}

 

 

1 ACCEPTED SOLUTION

RudhraKAM
Tera Guru

Fixed with other approch

 

In the Reference variable , Select group member table and use the group sysID , this will fix the issue 

RudhraKAM_0-1689942149935.png

 

 

View solution in original post

8 REPLIES 8

Sagar Pagar
Tera Patron

Hi @RudhraKAM,

 

I would suggest to use the Group members table instead of group. You can use the simple reference qualifier.

 

Reference table: Group members [sys_user_grmember]

Condition:

User.active IS true

AND

Group IS selectGroup1

OR

Group IS selectGroup2

 

It will show users only specific to mentioned group.

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

RudhraKAM
Tera Guru

Fixed with other approch

 

In the Reference variable , Select group member table and use the group sysID , this will fix the issue 

RudhraKAM_0-1689942149935.png

 

 

I tried this but I am getting created by list instead of user name list. Any idea why?

 

You'll need to check the Display checkbox on the User field's dictionary entry in the Group Member table. Only then User name will show up instead of the Created By details.