Reference Qualifier for "sys_user_grmember" on Service Catalog Form

Zubair Alam
Tera Contributor

How can I set up the reference qualifier so that only the members of the group "EUC-APCL-AHA" are visible on this reference field on Service Catalog form? With the current selection, its only showing the sys_id list of all the entries on "sys_user_grmember" table.

Any help is greatly appreciated. Thanks.  

 

find_real_file.png

4 REPLIES 4

-O-
Kilo Patron
Kilo Patron

To select a user (Assigned to) one ought to create a reference to User (sys_user), not Group Member (sys_user_grmember). You could possibly make it show user names by manipulating/configuring the display value of Group Member, but that would be a global setting ans still the wrong thing to do. The correct thing to do would be to make the reference point to User (sys_user) with a Script Include based reference qualifier that returned an encoded query that selects the correct users, or an encoded query based reference qualifier using a SUBQUERY term.

-O-
Kilo Patron
Kilo Patron

E.g. I have the setup below:

find_real_file.png

using Reference qualifier:

javascript: 'SUBQUERYsys_id,user,sys_user_grmember^group=' + current.variables.assignment_group + '^ENDSUBQUERY';

Whenever someone selects a group in the other variable - assignment_group, this variable displays just the members of the selected group.

It has the advantage that you have the possibility to display extra columns in the reference box making it easier to differentiate using with the same (display) name, but with different user ids and/or e-mails, by resorting to variable attributes.

-O-
Kilo Patron
Kilo Patron

The solution in "action" after changing the encoded query to only return active members:

javascript: 'SUBQUERYsys_id,user,sys_user_grmember^group=' + current.variables.assignment_group + '^ENDSUBQUERY^active=true';

The group (selected in the Assignment group - other variable):

find_real_file.png

The user selection window:

find_real_file.png

-O-
Kilo Patron
Kilo Patron

You just need to modify the encoded query "generator" to not rely on another (group reference) variable but a hard coded group's sys_id:

javascript: 'SUBQUERYsys_id,user,sys_user_grmember^group=' + GetIDValue('sys_user_group', 'EUC-APCL-AHA') + '^ENDSUBQUERY^active=true';