- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2025 11:01 PM
trying to get the managers list from script include and adding all of them in cc in notifications email script.
have list of event mappers. need to check if one of the event matches from the event mapper then execute the below. But its not executing. Appreciate the help.
if (eventMapper[event.name] == 'x_is_ma.create_request') {
var managersList = [];
if (current.u_submitt_on_behalf_of_email == '') {
managersList = utils.getManagersEmails(current.u_submitter_name.sys_id);
for (var i = 0; i < managersList.length; i++) {
email.addAddress("cc", managersList[i]);
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 02:36 AM
query sys_user with that email and pass the 3rd parameter as the manager name
are you sure it's getting inside this IF?
managersList = utils.getManagersEmails(current.u_submitter_name.sys_id);
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
‎02-02-2025 11:54 PM
email.addAddress requires 1 more parameter i.e. 3rd one which is display name
what does that array contain?
If it contains sysId then query sys_user with that and get the email and display name
Can you share the complete script here?
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
‎02-03-2025 01:58 AM
Hi,
getManagersEmails function is returning all the list of managers emails from the script include . but the only problem is with the line email.addAddress("cc", managersList[i]); can u guide what is missing here ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 02:02 AM
what does that array contain?
does it contain sysId or email of that manager?
I already told if it's sysId then query user table and get the email and display name and set like this
email.addAddress('cc', 'email', 'displayName');
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
‎02-03-2025 02:08 AM
@Ankur Bawiskar array has the list of email ids .