How to get members of field "Assignment group" in the lookup of Assigned to field.

VIKAS MISHRA
Tera Contributor

I have one field "assignment group" of type list collector where i can select multiple groups in this field. 

Now i have created one another field on the form named "Assigned to" and this field also is a type of list collector, and now here how can i make the changes so that i can see all the members of groups selcted in field "assignment group" only.

 

Please not above mentioned both the fields are list collector type not reference field 

2 REPLIES 2

Aman Kumar S
Kilo Patron

You will need a reference qualifier for this, since your field types is list.

1. You can create a script include and call that in the reference qual for the Assigned to field

2. Pass the parameter as assignment groups field, which is list of sys_ids of groups

3. you can use those information to glide the sys_user_grmember table and get the sys_ids of the users who belongs to those groups, and return the list of sys_ids

Best Regards
Aman Kumar

Pratik Malviya
Tera Guru

Hi @VIKAS MISHRA ,

 

You need to create advance reference qualifier and call script include function. Example,  create script include assignToUtils.

and write below function and call that in your advance reference qualifier.

example,

javascript: new assignToUtils.refqualassignedto(current);

function refqualassignedto(current){


  var group = current.u_assignment_group_2.split(","); // your assignment group variable name

  var user_array = [];

  if(group!=''){

  var getMembers = new GlideRecord('sys_user_grmember');

  getMembers.addEncodedQuery('group.sys_idIN'+group);

  getMembers.query();

  while(getMembers.next())

  {

  user_array.push(getMembers.getValue('user'));

  }

  return 'sys_idIN' + user_array.toString();

  }

}

If this helps you, please mark it as correct.

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Thanks,
Pratik Malviya