
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 11:54 AM
I am working in a custom scoped application and have some fields I have added that reference the User table. I am trying to limit the users available in the fields to a few groups those users would be apart of and being that this is a scoped application I am unable to use the global reference qualifiers.
I have a script include I am working on but something is not right as the field still just pulls all users.
the reference qual on the field is - javascript: active=true^getOHMMembers();
my script include is as follows and is created in the custom application's scope.
var getOHMMembers = Class.create();
getOHMMembers.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getMember : function(){
var grpName = 'APP_SN-CAD-OHMConfig';
var user_array = [];
var getMembers = new GlideRecord('sys_user_grmember');
getMembers.addQuery('group', grpName);
getMembers.query();
while(getMembers.next()){
user_array.push(getMembers.user + '');
}
return 'sys_idIN' + user_array.toSring();
},
type: 'getOHMMembers'
});
I am trying to get just one groups members to pull back but I will have a few groups that will be added once I can get this working. I have also tried to use group.name in the query as well as the sys_id of the group in the variable but all results are the same.
Any help is much appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 12:05 PM
In advance ref qualifier use
javascript: 'sys_idIN' + new GetGpMember().getUsers();
Script include:
var GetGpMember = Class.create(); GetGpMember.prototype = {
initialize: function(){ },
getUsers: function()
{
var array = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group.name", "Your group name");
gr.query();
while(gr.next())
{
array.push(gr.getValue('user'));
}
return array.toString();
},
type: 'GetGpMember'
};
Feel free to mark correct and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 12:05 PM
In advance ref qualifier use
javascript: 'sys_idIN' + new GetGpMember().getUsers();
Script include:
var GetGpMember = Class.create(); GetGpMember.prototype = {
initialize: function(){ },
getUsers: function()
{
var array = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group.name", "Your group name");
gr.query();
while(gr.next())
{
array.push(gr.getValue('user'));
}
return array.toString();
},
type: 'GetGpMember'
};
Feel free to mark correct and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 01:34 PM
Thank you so much Rahul! That worked like a charm.
If I wanted to add another group so that I am looking at two groups of members, is that possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 08:34 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2022 07:12 AM
Thank you Rahul!