- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 07:54 AM
I have a custom reference field where i want to return all the group members from one group (to be able to select one). At the moment it points to sys_user_grmember and it just returns the group name multiple times. I'd rather not customize anything about sys_user_grmember as that is used in other modules. Found the encoded query below to add into the attributes of the reference field, but it doesnt seem to have an affect.
Also tried to modify the columns attribute using ref_ac_columns=user, but that do anything either.
Encoded query tried:
javascript:var gr = new GlideRecord('sys_user_grmember');gr.addQuery('group',"<group sys id here>");gr.query();var users='';while(gr.next()){users+=gr.user.sys_id + ",";}"sys_idIN" + users;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 08:08 PM
I used a clean PDI to add a field called App Devs on the incident table to only return the users in the Application Development group.
Final outcome after clicking lookup:
Column entry:
Script Includes:
Group:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 03:52 PM
You are correct. The function name can be anything. I just recommend naming in a way that makes sense so later down the road you know what that function is doing without having to scroll through the scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 10:32 AM
If you want your reference field to display a list of users, and store the value of the user selected, then the referenced table must be sys_user! Your reference qualifier would then call a Script Include to do a GlideRecord on sys_user_grmember, returning a list of sys_ids - or you should be able to use your example as the reference qualifier, provided you use an actual group sys_id in quotes and replace : with the colon character.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 01:31 PM
Thanks. The colon is rendered on the page somehow automatically on this forum. That encoded query looks fine and returns the expected user ids when tested in a fix script. Ive repointed the reference field to user as a tes and added my original query back, it doesnt seem to have any effect on the reference field results though for some reason. It seems to just pull from the reference qual condition drop down
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 07:20 PM
Where are you trying to use this a filter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2024 07:21 PM
Its just a custom reference field on the demand form (dmn_demand)