Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Display group members from particular group dynamically in the reference type variable

Sai Santhoshi
Tera Contributor

I have record producer, in that record producer we have a variable with type reference, we want to display the group members dynamically in that particular group. Help with the reference qualifier 

1 REPLY 1

Harish KM
Kilo Patron
Kilo Patron

Hi @Sai Santhoshi Assuming you have 2 variables

Group --Referenced to group table

User --> referenced to User table

Create a function within script include like below

getMember: function(grpName){

        var gr = new GlideRecord('sys_user_grmember');
        gr.addQuery('group', grpName);// group name comes from variable
        gr.query();
        var members = [];
        while(gr.next())
        {
            members.push(gr.getValue('user'));
            //gs.info("mem"+members);
        }
        return 'sys_idIN' + members.toString();
    },

Call the above funtion in your User variable's reference qualifier like below

javascript:new ScriptincludeName().functionName(current.variables.variableName);

HarishKM_0-1710311413218.png

 

Regards
Harish