e-mail script to use Parm 2 in cc - Need some help

Karthick PS
Tera Contributor

I am using the below e-mail script to use the Parm 2 values in  "CC" for e-mail notification.

 

email.addAddress("cc",event.parm2);

But, its not sending to "CC" in the e-mail.. Please help..

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

did you try sending the 3rd parameter as well i.e. display name?

If event.parm2 is sys_id of user then query it and include display name

if that is email then query user table with email and include display name

var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", event.parm2);
gr.query();
if (gr.next()) {
	email.addAddress("cc", gr.getValue("email"), gr.getValue('name'));
}

Regards
Ankur

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

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

did you try sending the 3rd parameter as well i.e. display name?

If event.parm2 is sys_id of user then query it and include display name

if that is email then query user table with email and include display name

var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", event.parm2);
gr.query();
if (gr.next()) {
	email.addAddress("cc", gr.getValue("email"), gr.getValue('name'));
}

Regards
Ankur

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

No. Parm 2 is from the 'Create Event' in the workflow that is triggering the Notification.

THis notification has the e-mail script in its body..

I want to send the whole thing in Parm 2 to CC.

find_real_file.png

then write query as I mentioned

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

Ok.

You mean in the E-mail script??