Add multiple email addresses to List Collector on Service Portal/Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 10:20 AM
Hello.
Within a catalog item, we have two fields. One is for the user's name the other for their email address.
I've used the table 'sys_user' for both fields. When the user's name is populated, I have it automatically adding their email address to the specific email field, both with 'List Collector' as their variable type.
Issue I am having, is if multiple users are added to the User field, no email address (even previously displayed for the first user) will be displayed. How do I get each additional email address to be displayed in the List Collector / email field?
- Labels:
-
Incident Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 01:20 PM
Writing glide record in client side scripting is not a good practice.
I would suggest use glide ajax and do the glide record part inside client callable script include.
Sample Code:
Script Include:
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld: function(){
var et = this.getParameter('sysparm_user_name');
var res = et.split(',');
var abc = [];
for(var i=0;i<res.length;i++){
var gr = new GlideRecord('sys_user');
gr.get('sys_id',res[i]);
abc.push(gr.getValue('email'));
}
return abc.join(",");
},
type: 'HelloWorld'
});
Screenshot:
Catalog Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name', 'helloWorld');
ga.addParam('sysparm_user_name', g_form.getValue('test').toString());
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('test1',answer);
}
}
Screenshot:
Result:
Note: set the variable name correctly in client script, i test and working perfectly.
If my answer helped you, kindly mark it as correct and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 06:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 06:07 AM
i tested it and its working perfectly at my end. can you please add alert() inside client script and see what are you getting there ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 06:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 06:17 AM
Hi Mairvette,
Can you try my code as mentioned in my last reply?
Thanks,
Mohit
Mohit Kaushik
ServiceNow MVP (2023-2025)