Getting Managers and adding them in cc

SAS21
Tera Guru

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]);
}
}
}

1 ACCEPTED SOLUTION

@SAS21 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

@SAS21 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader