- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2018 03:23 AM
Hi,
I'm developing a form that will send an email notification once approved. The form has a list collector* variable. The email notification will need to display all users selected on the list collector along with their email addresses. The email notification I'm setting is part of the catalog item workflow.
Since the list collector stores all users in one variable, how do I go about getting all users selected emails and then display them on the body of the email notification?
If I need to write an email script, please help with providing some examples.
Thank you
* the list collector references the sys_user table
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2018 03:51 AM
Hi,
Since it is a reference field you need to query to get all username and email addresses
sample script
var users = current.variables.<listCollectorVariable>;
var userRec = new GlideRecord('sys_user');
userRec.addQuery('sys_id', 'IN', users.toString());
userRec.query();
while(userRec.next()){
template.print('User Name is:' + userRec.user_name + ' email address is: ' + userRec.email);
}
Mark Correct if this solves your issue and also mark 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
‎11-16-2018 03:51 AM
Hi,
Since it is a reference field you need to query to get all username and email addresses
sample script
var users = current.variables.<listCollectorVariable>;
var userRec = new GlideRecord('sys_user');
userRec.addQuery('sys_id', 'IN', users.toString());
userRec.query();
while(userRec.next()){
template.print('User Name is:' + userRec.user_name + ' email address is: ' + userRec.email);
}
Mark Correct if this solves your issue and also mark 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
‎01-27-2023 11:00 AM
Ankur, could you assist me with
Thanks!