- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 05:58 AM
Hi ,
I have a list collector field in a table , which is referencing to user table , my requirement is to add those users in a email cc , so how can we do this via email scripts or any other ways ?
Thanking you in advance...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 06:03 AM
should be easy task
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", "IN", current.u_my_field);
gr.query();
while (gr.next()) {
email.addAddress("cc", gr.getValue('email'), gr.getValue('name'));
}
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 06:03 AM
should be easy task
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", "IN", current.u_my_field);
gr.query();
while (gr.next()) {
email.addAddress("cc", gr.getValue('email'), gr.getValue('name'));
}
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 03:34 AM
It worked Thanks