Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

populate list collector based on another reference field

levino
Giga Guru

hi there

 

on a catalog item there are two fields


reference field 'sys_user_group' existing_group

 

i also have a list collector field 'sys_user'


i need to populate the list collector based on the existing_group field, i tried the below solution, but could not get it to work.

 

am i missing something?

Thanks

Levino

 

 

Script include

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

	getName: function(groupSysID){
		var arr = [];
		var gr = new GlideRecord('sys_user_grmember');
		gr.addQuery('group',groupSysID);
		gr.query();
		while(gr.next()){
			arr.push(gr.getValue("user"));
		}
		return 'sys_idIN'+ arr;

	},

	type: 'Get_group'
};


Ref qualifier:

javascript: "sys_idIN"+ new Get_group().getName(current.variables.group_field_name);

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@levino 

ensure you set variable attributes as well for that list collector variable

ref_qual_elements=group_field_name

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

View solution in original post

3 REPLIES 3

Thanks Siddharam

just one question on the above solution in the link on ref qualifier

it only specifies the function name , does it need to include the scrip include name as well?

 

Thanks

the List Collector field - "Assigned to" - you have to update the Reference Qualifier (advanced) as 
javascript: getMembers(current.assignment_group);

Ankur Bawiskar
Tera Patron
Tera Patron

@levino 

ensure you set variable attributes as well for that list collector variable

ref_qual_elements=group_field_name

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