- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 08:32 AM
Hi,
I have a reference variable called "Project Lead". I want to only show members of the Physical Security group in this field. From what I've read it seems a reference qualifier should be used. After reading some articles I tried entering the following:
Reference qualifier: javascript:new GetGroupMember().getMember(bb3fc3056f68e10006a8f00dba3ee483)
I'm passing the sys_id of the Physical Security group.
Script Include:
var GetGroupMember= Class.create();
GetGroupMember.prototype = {
getMember : function(bb3fc3056f68e10006a8f00dba3ee483)
{
var user_array = [];
var getMembers = new GlideRecord('sys_user_grmember');
getMembers.addQuery('group',bb3fc3056f68e10006a8f00dba3ee483);
getMembers.query();
while(getMembers.next())
{
user_array.push(getMembers.getValue('users'));
}
return 'sys_idIN' + user_array.toString();
}
};
What happens is I get the entire sys_user table unfiltered. How do I just get the members of the Physical Security group so I can select one of them?
Any help is appreciated, as I am new to scripting.
Thanks,
Laurie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 11:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 10:52 AM
in the script include function make this the first line
gs.addInfoMessage('hello Laurie');
This will tell you whether the issue is in the script include function or while calling, If this message appears on the lookup window then this function is wrong, otherwise we are calling it in a wrong way.
Do this and then we will solve it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 10:59 AM
The message did not appear, so the issue must be when calling.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 11:00 AM
Try this in the reference Qual
javascript:new GetGroupMember().getMember();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 11:21 AM
I got the "hello Laurie message! But no user names...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 11:37 AM
that is because you are returning the string "sys_idIN*****" and instead of sys_id you added the names of users
so in the script include function replace "user_array.push(getMembers.user.getDisplayValue());"
with
"user_array.push(getMembers.user);"