Reference field referring to user table

Chirag Jain3
Tera Expert

Hi,

 

I have a reference field named "TRO" on the incident which refers to the user table & we have to show users who are part of the "ABC" group. Can someone please help me out on this?

 

Regards,

Chirag Jain

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Chirag Jain3 

2 ways

1) have role assigned to that group and then assign advanced ref qualifier with roles=roleABC

OR

2) have advanced ref qualifier and call script include and get group members of that group

what did you start with and where are you stuck? this is an easy task

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Mark Manders
Mega Patron

Create a script include:

var ABCGroupUsers = Class.create();
ABCGroupUsers.prototype = {
    initialize: function() {
    },
    
    getABCGroupUsers: function() {
        var users = [];
        var grMember = new GlideRecord('sys_user_grmember');
        grMember.addQuery('group.name', 'ABC');
        grMember.query();
        while (grMember.next()) {
            users.push(grMember.user.sys_id.toString());
        }
        return users.join(',');
    },

    type: 'ABCGroupUsers'
};

 

And set the reference qualifier on the field to this: 

 

javascript: 'new ABCGroupUsers().getABCGroupUsers()'

Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark