email script in CC - Requestor's manager, Assignment Group members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 06:30 AM
Hi Everyone,
In email script I have to populate Requestor manager and assignment group members in CC
- CC - Requestor's manager, Assignment Group members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 06:42 AM
Hello @PujithaB,
you can use email script and do this and include that email script in your email body
I hope you are aware on how to include email script in email body
Scripting Email Notifications in ServiceNow
I assume assignment_group field is on current table and notification is also on same table
var group = current.assignment_group;
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", group);
gr.query();
while(gr.next()) {
email.addAddress("cc", gr.user.email.toString(), gr.user.name.toString());
}
email.addAddress("cc", current.requested_for.manager.toString(), current.requested_for.manager.name.toString());
Please mark my response as Accepted and Helpful for future references.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 06:58 AM
Using this code, only assignment group members are populated.
Requestors name not populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 08:08 AM
Can you share your script? @PujithaB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 06:45 AM - edited 07-23-2025 10:40 PM
Hello @PujithaB
You can achieve this using below code:
var group= new GlideRecord("sys_user_grmember");
group.addQuery("group", current.assignment_group);
group.query();
while(group.next()) {
email.addAddress("cc", group.user.email.toString(), group.user.name.toString());
}
email.addAddress("cc", current.requested_for.manager.email.toString(), current.requested_for.manager.name.toString());