In the assigned to i want to see particular group members name

pavithraptr
Tera Contributor

In the assigned to i want to see particular group members name without applying anything on assignment group. which query i need to use in reference qualifier 

1 ACCEPTED SOLUTION

Hi @pavithraptr,

 

on the variable where you want to select the group members you need to call script include that will return the group members.

 

Something like this:

GlideFather_0-1757532238273.png

variable's ref qualifier on sys_suer table:

javascript: 'sys_idIN' + new groupUtils().getSandstormMembers();

 

calling script include called groupUtils and function getSandstormMembers()

 

And the script include:

GlideFather_1-1757532343078.png

 

 

var groupUtils = Class.create();
groupUtils.prototype = {
    initialize: function() {},

    getSandstormMembers: function() {
        var userIDs = [];
        var gr = new GlideRecord('sys_user_grmember');
        gr.addEncodedQuery('group=YOUR_GROUP_SYS_ID^user.active=true');
        gr.query();
        while (gr.next()) {
            userIDs.push(gr.user.toString());
        }
        return userIDs.join(',');
    },

    type: 'groupUtils'
};

 

This will return just the active members, so even a group member of that group who is inactive won't be selectable. If you want to allow inactive suers as well, remove the "^user.active=true" part from the encoded query.

 

Let me know if this helped, works fine for me

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


View solution in original post

5 REPLIES 5

pavithraptr
Tera Contributor

@GlideFather @Nikhil Bajaj9 

I have a group called leads. In the form i have a assessment leads field.When i try to select assessment leads it should only show members who are members of leads group