- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 06:11 AM
Hello!
I have a catalog item that contains 2 variables of type Single Line Text and List Collector. The single line text contains a comma separated of User IDs. Is there a way to copy these user ids to a List Collector (List table: sys_user ) and display the Name?
Please help!
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 01:58 AM
what you want to do by returning true or false?
If you want to set the values then do this
Script Include:
var UserUtils = Class.create();
UserUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getManagersList: function() {
var user = this.getParameter('sysparm_value');
var ans = [];
var gr = new GlideRecord("sys_user");
gr.addQuery("user_name", "IN", user);
gr.query();
while (gr.next()) {
ans.push(gr.getUniqueValue());
}
return ans.toString();
},
type: 'UserDetailsUtils'
});
Client Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '')
return;
var gx = new GlideAjax('UserUtils');
gx.addParam('sysparm_name', 'getManagersList');
gx.addParam('sysparm_value', g_form.getValue('managers_list_userid')); //text variable containing user ids
gx.getXMLAnswer(function(answer){
g_form.setValue('managers_list', answer.toString()); //list collector
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-03-2023 06:13 AM
In the list collector set your filter to sys_id <is one of> your list with sys_id's.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 06:16 AM
@Peter Bodelier, the value is dynamic. Our client has an existing process that populates the single line text variable with a list of User IDs. The requirement is to show the User IDs in a list collector and display the names.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 06:20 AM
So you want that to work a reference qualifier?
If so, you could use the list of sys_id's in the variable as reference qualifier in the list collector.
Something like javascript: 'sys_idIN' + current.variables.sysidlist
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 06:34 AM
@Peter Bodelier The values in the single line text variable contains User IDs instead of Sys IDs. The requirement is to show these values on another variable (list collector) and display their names.
For example:
Name: ServiceNow User1
User ID: sn_user1
Name: ServiceNow User2
User ID: sn_user2
The catalog item contains a select box, a single line text (hidden, called User IDs) and a List Collector (called User Names) variables.
When the form loads and the user selects an option in the select box, the User IDs variable will be populated with values (ex. sn_user1, sn_user2). There is another process that populates this variable.
Once this is populated, the List Collector will be populated with the Names (ex. ServiceNow User1, ServiceNow User2),