
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-28-2024 08:26 AM
I have a User Reference variable on a catalog item. The BU does not want their names to be in the list of users. I created a script include:
filterOutByGroupName: function(group_name) {
/* Will remove users of the specified group from the list */
var found_users = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group.name", group_name);
gr.addNotNullQuery("user");
gr.query();
while (gr.next()) {
found_users.push(gr.user.sys_id.toString());
}
var ref_qual = "sys_idNOT IN" + found_users.join(",");
return ref_qual;
},
And I have added this to the Advanced Ref Qual:
javascript: new UserFilterUtils.filterOutByGroupName('Reporting');
But, I am still getting the users from that group in the list. What am I doing wrong?
Thank you, Charles
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-28-2024 12:47 PM
Hi @cgedney,
Didn't go through the entire code but looks like it's missing a set of parenthesis
i.e.
new UserFilterUtils().filterOutByGroupName('Reporting');
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-28-2024 12:47 PM
Hi @cgedney,
Didn't go through the entire code but looks like it's missing a set of parenthesis
i.e.
new UserFilterUtils().filterOutByGroupName('Reporting');
Cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-28-2024 12:56 PM
It's always those little things I don't notice, no matter how long I stare at it.
Thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-28-2024 01:19 PM
I just copied/paste your reference qual. I noticed there's a semicolon at the beginning and It seems you are missing the () after the first function call. So it should be:
javascript: new UserFilterUtils.filterOutByGroupName('Reporting');
Updated reference qualifier:
javascript: new UserFilterUtils().filterOutByGroupName(groupName);
If my answer helped you in any way, please then mark it as helpful/Accepted.