- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 03:10 PM
I have a reference field on a request form that I have the reference qualifier set up:
This returns the sys_id in the reference field
How can I change the value displayed to be the user name?
And I don't know why when I select one of the sys_id's above that it populates the field with the 'created date/time'.
Any help is appreciated!! TIA
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 06:24 AM
I had to make a few modifications and I was able to get this working. Thanks for your help! Much appreciated!
In the script include:
function get_projectsponsor_members(){
var answer = '';
var group = 'd4439e614f7cf200f76d27201310c713'; //Project Sponsor group sys id (not on form)
var group_members = new GlideRecord('sys_user_grmember');
group_members.addQuery('group',group); // ('group',group);
// group_members.addEncodedQuery('group=d4439e614f7cf200f76d27201310c713');
group_members.query();
var memberList = [];
while(group_members.next()){
memberList.push(group_members.getValue('user'));
}
return 'sys_idIN' +memberList.join();
}
AND I changed the variable to be a lookup select box field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 08:20 AM
Yes.. I have been trying multiple ways to try to get this to work. 1. With a Simple reference qualifier & 2. Advanced ref qualifier — via Script include.
Thought I would show you both in case I should be going about this a different way.
Thanks for catching what is wrong with my advanced qualifier. Changed the script include name to be correct 'get_projectsponsor_members' and now I'm getting the users names in the answer variable but the names are NOT displaying in the list for me to choose from.
Which way is the best way to do what I'm trying to do? 1. Or 2.
Then we can look at that way to get it working.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 12:57 PM
The best way is always the simplest. If you can get away without scripting - take it.
That being said, I took a closer look at your script. You seem to be capturing the names of the group members. What you need is sys_ids. Something like this:
function get_projectsponsor_members() {
var answer = [];
var groupName = 'Project sponsors'; // Update accordingly
var grmember = new GlideRecord('sys_group_grmember');
grmember.addQuery('group.name', groupName);
grmember.query();
while (grmember.next()) {
answer.push(grmember.getValue('user'));
}
return 'sys_idIN' + answer.join(',');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 06:24 AM
I had to make a few modifications and I was able to get this working. Thanks for your help! Much appreciated!
In the script include:
function get_projectsponsor_members(){
var answer = '';
var group = 'd4439e614f7cf200f76d27201310c713'; //Project Sponsor group sys id (not on form)
var group_members = new GlideRecord('sys_user_grmember');
group_members.addQuery('group',group); // ('group',group);
// group_members.addEncodedQuery('group=d4439e614f7cf200f76d27201310c713');
group_members.query();
var memberList = [];
while(group_members.next()){
memberList.push(group_members.getValue('user'));
}
return 'sys_idIN' +memberList.join();
}
AND I changed the variable to be a lookup select box field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 06:27 AM
Excellent. Thanks for the update Christina.
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 09:48 PM
Hi Christina,
Set the display value of group name to true in sys_user_grmember table, then only it displays the name instead of sys_id.
Please hit correct,like or helpful if it solves your issue.