Select group members; 1. reference variable to select group 2. variable to select a member

Bret Smith
Giga Guru

Reference variable to select a group: groupname

('OIT ITD' is the group name we are selecting)

 

Reference variable to select members from the group entered above: itd_approval_name

BretSmith_1-1717459130503.png

 

BretSmith_0-1717459101841.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.
    }
   
}

 

 

Enter OIT ITD for the group

 

BretSmith_2-1717459254271.png

but noit getting any returned members names 

 

1 ACCEPTED SOLUTION

Nick Parsons
Mega Sage

You have a typo in your reference qualifier it should be current.variables not current.varaibles. You also shouldn't need the ref_qual_elements attribute, that's not meant for reference fields.

View solution in original post

2 REPLIES 2

Nick Parsons
Mega Sage

You have a typo in your reference qualifier it should be current.variables not current.varaibles. You also shouldn't need the ref_qual_elements attribute, that's not meant for reference fields.

Community Alums
Not applicable

@Bret Smith Changes proposed by @Nick Parsons will resolve your issue.