
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2018 12:36 AM
How do I get the email address of user from List Collector so I can send email notification to them via Workflow?
I tried this script but not working. Please help!
//I named my list collector field choose_name
answer = [];
var user = current.variables.choose_name.split(',');
for (var i = 0; i < user.length; i++) {
var u = new GlideRecord('sys_user');
if (u.get(user[i])) {
answer.push = email.addAddress("user", u.email, u.getDisplayValue());
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2018 02:23 AM
Hi Kay,
you need an array to hold the sys_id and then use the answer variable
answer = [];
var emailSysId = [];
var user = current.variables.choose_name.split(',');
for (var i = 0; i < user.length; i++) {
var u = new GlideRecord('sys_user');
if (u.get(user[i])) {
emailSysId.push(u.sys_id.toString());
}
}
answer = emailSysId;
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2018 02:23 AM
Hi Kay,
you need an array to hold the sys_id and then use the answer variable
answer = [];
var emailSysId = [];
var user = current.variables.choose_name.split(',');
for (var i = 0; i < user.length; i++) {
var u = new GlideRecord('sys_user');
if (u.get(user[i])) {
emailSysId.push(u.sys_id.toString());
}
}
answer = emailSysId;
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2018 09:02 PM
Hello Ankur,
Thanks for your script, i tried it but still not sending email notifications to the selected names on the right. Please see below snips.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2018 09:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2018 12:04 AM
Hi Kay,
Can you add log statement and check whether variable value is coming or not?
var user = current.variables.choose_name.split(',');
gs.log("Users from variable are:"+user);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader