When Assigned to field is selected then groups will auto populated in assignment group in which assign to is member by using client script.

Shraddha desai
Tera Contributor

Hello,

When Assigned to field is selected then groups will auto populated in assignment group in which assign to is member by using client script.

I want only those groups will show in assignment group in which that selected user in assigned to field is member.

 

Thanks and regards

shraddha Desai.

1 ACCEPTED SOLUTION

find_real_file.png

 

Mark Correct AND Helpful if it helps you resolve the issue. Thanks!

View solution in original post

6 REPLIES 6

Vaibhav Dane
Tera Expert
Tera Expert

Hi Shraddha,

 

You can use advanced reference qualifier on assignment group field and show only selected user groups.

 

Please mark correct if answer is helpful.

 

Regards,

Vaibhav

Yes I know..but can we solve this from client script?

Hi,

User Advanced reference qualifier for the assignment group

  • Add the below script in the “Reference qual” field

javascript:new getAssignmentGroups().filterd(current);

  • And create a new Script include with name “getAssignmentGroups” and function “filterd”
  • var getAssignmentGroups= Class.create();

    getAssignmentGroups.prototype = {

        initialize: function() {

        },


    filterd: function(current)

    {

    var groups = [];

    var assigned_to= current.assigned_to;

    if(assigned_to!= '')

    {

    var gr = new GlideRecord('sys_user_grmember');

    gr.addQuery('user',assigned_to);

    gr.query();



    while(gr.next())

    {

    groups.push(gr.group);

    }

    }

    return 'sys_idIN' + groups;

    },

        type: 'getAssignmentGroups'

    };


Hi Bharath,

This is returning only 1 assignment group. If any user is a part of more than 1 assignment groups how can we achieve it?