Making Assignment Group and Assigned to inter-dependent

phenkry
Tera Contributor

Hi everyone,

 

I have a requirement that I thought would be pretty easy but I can't figure it out.
Also, I thought I would find the solution quickly by googling but no success. Maybe I'm not searching for the right keywords.

In the Incident form, I want to do the following:

  • If I choose a group in Assignment group field, I want choices in Assigned to field filtered to only group members (OOB)
  • Vice versa, if I first choose a user in Assigned to field, I want choices in Assignment group field filtered to only groups that user belongs to (not OOB)

How do I achieve this? Please help!

thanks - Parker

3 REPLIES 3

Steven Young
Tera Guru

so i think natively, you're not going to get this.
on the Assigned To field, you can configure the dictionary and select the "dependent" field of "assignment group" (whatever your assignment group field is)
then when you set your assignment group, you'll get only the group members.

however, i dont believe this works the other way around.
You'd have to write a filter that gets the assigned to, and then looks at the available groups. but if the assigned to is blank, then returns all groups.


edit the dictionary of the Assignment Group:
Change the "Use Reference Qualifier" to "Advanced"
set the Reference Qual to: 

 

javascript : new getUserGroups().getGroups(current.assigned_to)

StevenYoung_1-1679365667639.png



Then create a script includes:

Name: "getUserGroups"
Script:

 

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

    getGroups: function(user) {

        if (user) {
            var groups = [],
                grGroupMember = new GlideRecord("sys_user_grmember");
            grGroupMember.addQuery('user', user);
            grGroupMember.query();
            while (grGroupMember.next()) {
                groups.push(grGroupMember.group.sys_id.toString());
            }

            return "sys_idIN" + groups;
        } else {
            return "active=true";
        }

    },

    type: 'getUserGroups'
};

 


Where the "active=true" is where you'll want your default filter for the assignment group if the assigned to is blank.

Hi everyone did this solution work ? 

 

This has worked for me for years.
i just tried this exact solution in a PDI.
When i set the group, the assigned to is dependent on the Group.
When i set the user, it is limited to only the assigned to's group list.
So, it takes about 2 minutes to setup. give it a shot yourself.