Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Reference qualifier to pull members of group into a field

paradise623
Giga Expert

Hi All,

 

I'm looking pull users of a specific group into a field called "system users" . I went into the dictionary and looked under reference qualifier, but how do I pull in only member of a particular group?

 

4 REPLIES 4

Sumanth16
Kilo Patron
Hi @paradise623 ,

It is filtering the sys_user reference list depending on the current value of the group field of the current record using an advance reference qualifier with the expression:

javascript:'sys_idIN'+getIDs(current.group); function getIDs(grp){var m=GlideUserGroup.getMembers(grp);var ids=''; while (m.next()){ids+= (m.user+',');} return ids;}
This approach could be applied to meet the customers requirement to display only active users that belong to a specific group with sys_id=2d6649bbdbb356004ff5f4331f961924

I suggest in your reference field you use an advanced reference qualifier with the following expression:

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


If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!



Thanks & Regards,

Sumanth Meda

Maddysunil
Kilo Sage

@paradise623 

In the dictionary of "system users" field, There is a dependent field section. In the dependent field you can provide the database name of your group field.

 

For example: In incident table assigned to depends on assignment group, so in dictionary of assigned to if you check the dependent field it is mentioned assignment_group.

 

Please mark my response correct/helpful if it helps you.

Thanks

Aman Kumar S
Kilo Patron

Hi @paradise623 

Are you planning to pull users only from a certain group, you can set the reference qualifier as, update the group's sys_id on the getIDs functional parameter:

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

Best Regards
Aman Kumar

Amit Verma
Kilo Patron
Kilo Patron

Hi @paradise623 

 

Assuming you want members of a particular group to be displayed in the referenced field "system users", you can make use of a either dependent field or use a simple reference qualifier with condition Group is "Your Group Name".

 

AmitVerma_0-1707888428506.png

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.