Return colums from reference lookup

Bret Smith
Giga Guru

I dont wanted the created on field to show in my selections that are returned from 

 

BretSmith_1-1717435868102.png

Variable Attributes ref_auto_completer=AJAXTableCompleter,ref_ac_columns=user,ref_ac_columns_search=true,ref_ac_order_by=user

 

 

BretSmith_0-1717435655621.png

 

5 REPLIES 5

James Chun
Kilo Patron

Hi @Bret Smith,

 

I don't believe you can hide the display value in the reference variable, in this case, the created timestamp.

 

It looks like you are selecting a User in the variable, and if so, you should be using the [sys_user] as the referenced table instead of the [sys_user_grmember] table.

Once you select the [sys_user] as the reference table, you won't see the created timestamp as it's not the display value on the [sys_user] table.

 

Cheers

Ok, if I use the sys_user table I only want to the users in the sys_user table that are members of the OIT ITD group

You can write a Script Include to get a list of members from the group selected in another variable.

Have a read at this link  -https://www.servicenow.com/community/developer-articles/catalog-items-make-assigned-to-dependent-on-...

 

Make sure you use your variable that reference the group table, I think it's the Agency in your case.

here is what I have done and I am getting "no Matches".....

 

variable on my form to select group name is: groupname

Reference: sys_user_group 

 

the variable that I want to select a member from the group entered (in the groupname variable) is named: itd_approval

 

BretSmith_0-1717458492553.png

 

 

 

Script Include named:findgroupmembers

function findgroupmembers(group) {
   
    var users = [];
   
    if (group != '') {
        var getGroupMembers = new GlideRecord('sys_user_grmember');
        getGroupMembers.addQuery('group', group);
        getGroupMembers.query();
        while (getGroupMembers.next()) {
            users.push(getGroupMembers.getValue('user'));
        }
        return 'sys_idIN' + users.toString();
    } else {
        return 'sys_idIN';
             //return 'active=true'; //uncomment this line if you want to return all the active users if assignment group is not selected. Must Comment just above line.
    }
   
}