Get the assigned to based on assignment group

Pravallika9
Tera Expert

Hi,

OOB assignment group and assigned to fields are reference fields.

I have written a script where based on assignment group assigned to members to shown in the reference.

 

My requirement is the user should have the capability to select multiple groups as well as multiple assigned to.

I have created list type assignment group and assigned to fields respectively.

But when I select the assignment groups then in assigned to all the users are visible.

I want the dependancy of assignment group in assigned to.

But it is not happening.

Please suggest some ideas how to proceed

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@Pravallika9 

on which table you are doing this?

OOB assigned to is already dependent on assignment group

what script did you start with and where are you stuck?

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

Hi Ankur,

In oob it is for reference fields where we select single assignment group.

Currently I have created custom fields of Type LIST where user has option to select multiple groups and also same dependant group members. 

I am not sure how to start

@Pravallika9 

Unless you start you cannot learn

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

hi ankhur
I have tried the below script

 var assignmentGroups = current.assignment_group.toString().split(',');
 var gr = new GlideRecord('sys_user_grmember');		//gr.addEncodedQuery('group=8a4dde73c6112278017a6a4baf547aa7^ORgroup=d625dccec0a8016700a222a0f7900d06');
     gr.addQuery('group', 'IN', assignmentGroups);
        gr.query();
        var userIDs = [];
        while (gr.next()) {
            userIDs.push(gr.getValue('user'));
        }
        gs.log(userIDs);
        return 'sys_idIN' + userIDs.join(',');
    

When tried backend i am getting the sys_ids of all the group members.
But in assigned_to field the list reference is showing as empty.

I have written reference qualifier on assigned_to field