- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 12:10 AM
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);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 09:42 PM
ensure you set variable attributes as well for that list collector variable
ref_qual_elements=group_field_name
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 11:20 AM
Hi @levino this might help you https://www.servicenow.com/community/developer-articles/dynamically-add-values-to-the-list-collector...
Regards,
Siddha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 08:43 PM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 09:42 PM
ensure you set variable attributes as well for that list collector variable
ref_qual_elements=group_field_name
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader