Show group members for a selected user on a catalog item form

incrypto
Tera Contributor

I've been searching the community but nothing has come up that will work for me. I'm trying to enhance a catalog item we have that is for managing group membership. We'd like the person submitting the request to be able to select a user from a list and then the groups that user is in displays.

Essentially, it would be useful for the submitter to know which groups they were in (or another user was in) to make an educated guess about what group to put the other person into (e.g. "I know I have Case access, and this guy needs Case access, so which group do I have?").

So something like this:

[Selected User]
Assignment Groups:
• Group A
• Group B
Other Groups:
• Group C
• Group D

Is this doable? Will I need to engage the devs on my team? I'm not coder myself, although I can manipulate existing scripts to work in some cases.

Thanks,

Steve

1 ACCEPTED SOLUTION

Then you will have to create Script Includes like below

find_real_file.png

var commonUtil = Class.create();
commonUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getUserGroups: function(user) {
        var groups = [];
        var gr = new GlideRecord('sys_user_grmember');
        gr.addQuery('user', user);
        gr.query();
        while (gr.next()) {
            groups.push(gr.group.sys_id);
        }
        return 'sys_idIN' + groups.toString();
    },

    type: 'commonUtil'
});

On variable of for groups do below

find_real_file.png

javascript:new commonUtil().getUserGroups(current.variables.person_to_mirror);

 

View solution in original post

12 REPLIES 12

That worked perfectly, thank you! Saved the day.

find_real_file.png

Hi @Mike Patel 

 

I have a requirement to show only groups that doesnt belong to the user for whom access is requested.

Could you pls help on that

Hi @sravya03 
Did you got the solution for this?

I have a same requirement. But, requester field is from a variable set. If you already have the solution please help on this. Thank you