
- 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-24-2018 12:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 01:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 01:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 11:13 AM
Used this in Madrid and worked perfectly, the only modification necessary was adding .toString() to the var user=
THANK YOU
answer = [];
var emailSysId = [];
var user = current.variables.choose_name.toString().split(',');
gs.info("Users from variable are:"+user);
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;