- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 11:22 AM
I have a catalog item with a list collector that gathers multiple users. When that variable comes through on the ritm/task, it's just a list of names. What is desired is for their user_name to also appear. However, I don't want a separate field on the form that they see when they're filling this out; I only want it to be passed to the ritm/task after the form is submitted. I thought I'd make a multiline textbox variable that could fill in the users and their usernames in this format:
by using a client script and script include. Neither is working and when I submit the form, I get 'Unhandled exception in GlideAjax'. Can you please look at what I have and help?
Here is the client script (ui type=all; applies to cat item, ritm, task):
function onSubmit() {
//array of sys_ids from list collector variable
var usersToAdd = g_form.getValue('persons_requiring_access').toString().split(',');
var ga = new GlideAjax('GetListCollectorVariables'); //call the script include
ga.addParam('sysparm_name', 'UsersListCollector'); //name of function in script include
ga.addParam('sysparm_users', usersToAdd); //pass array of users to SI
ga.getXML(GetVariables);
function GetVariables(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('persons_requiring_access_text', answer);
}
}
Here is the script include (client callable = true; global scope)
var GetListCollectorValues = Class.create();
GetListCollectorValues.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
UsersListCollector: function() {
var userInfo = '';
var usersFromListCollector = this.getParameter('sysparm_users');
var grUser = new GlideRecord('sys_user');
grUser.addQuery('sys_id','IN',usersFromListCollector);
grUser.query();
while(grUser.next()) {
userInfo += grUser.name + ' [' + grUser.user_name + ']';
}
return info.toString();
},
type: 'GetListCollectorValues'
});
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 04:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 03:22 PM
Can you please confirm the exact requirement, might be i can provide alternate solution if it's not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 03:24 PM
I have a catalog item with a list collector that gathers multiple users. When that variable comes through on the ritm/task, it's just a list of names. What is desired instead is for their user_name to also appear. However, I don't want a separate field on the form that they see when they're filling this out; I only want it to be passed to the ritm/task after the form is submitted. I made a multiline textbox variable (called "persons_requiring_access_text") that can be filled with the users and their usernames in this format:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 03:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 03:41 PM
I still need the user_name; it seems like that option only shows the name, first, last, and email. The client requires the list collector to be read-only on the ritm/task, which is why we don't have the slushbucket option.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 03:43 PM
you can include other column as well.
use the url below,
https://<your instance ID>.service-now.com/sys_user_list.do?sysparm_view=sys_ref_list
Once you will open , you can include other column by , Configure >> List Layout >> and the column based on your need.