email.addAddress("cc") is not working

Vidya Shree
Kilo Sage

We are trying to use email.addAddress() method for adding value to CC of email notification.

But it is not working.cc address is neither shown on copied field nor on headers field

When printing the value it is shown correct value

Please find the code below

email.addAddress("cc",current.opened_by.email.toString(), current.opened_by.getDisplayValue());

Thanks In advance

Vidyashree

13 REPLIES 13

Hello,

Yes, as you've now told us you're trying to do this in an email template...which helps everyone else see more information to assist you...

I hope my reply was Helpful in a few ways.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I doubt setting cc, bcc works from email script when called from email template.

Did you check setting the subject using email.setSubject() and check if it works fine?

Regards
Ankur

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

@Vidya Shree 

it is not supported

below explanation

If you see the annotations it says email object is null when used from Client Template

find_real_file.png

Regards
Ankur

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

Hi Ankur,

Thank you for your reply.

email.setSubject is working fine and is displayed in the email sent.

email.addAddress() is working perfectly fine in my developer instance when given in email template but the same is not working in company instance.

 

Thanks,

Vidyashree

Hi,

but as per documentation email object in client template is null so not sure how it worked in your PDI.

I would suggest to check once again

Regards
Ankur

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