adding User email on CC with email script

Peter Williams
Kilo Sage

Good Morning,

i have a reference field that is pointing to the sys_user table that will display a list of user informatiln. This field is Prepared By. 

What i would like to do in an email script is to have who ever the user is listed in the Prepated By field to be "CC" on the email notification that is sent out.

The sys_user table has their email address listed.

What is the easiest way to do this?

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@Peter Williams 

Notification is on which table

update as this

no need to use GlideRecord

1) does that user has valid email populated

2) is that user active and not locked out

3) is that user having notification preferences enabled in his/her profile

 

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

yes to all and its dymanic as different users will be filling out the form

 

User26251
Tera Contributor

were you able to find a solution to this?

 

no i am not able to find the solution to this 

still needing it to work

Give this a try on your email script. 

 

var user = new GlideRecord('sc_req_item');
user.get(current.document_id.sys_id);
if (user.isValidRecord()) {
email.addAddress("cc", user.variables.*your_variable*.email.toString(), user.variables.*your_variable*.getDisplayValue().toString());
}