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

Allen Andreas
Administrator
Administrator

Hello,

You didn't really tell us where you're using this script, but to throw it out there...you'd use this in a mail script.

Documentation for referencehttps://docs.servicenow.com/bundle/quebec-servicenow-platform/page/script/server-scripting/reference...

And so within the mail script you'd want to ensure that "current.opened_by.email" and "current.opened_by.getDisplayValue()" are appropriate to use. Please add any log statements to your mail script if you're unsure to see what you're getting back for these two pieces of information.

Once you've verified everything, you'd use:

${mail_script:name_of_mail_script} in the body of your notification, somewhere, and it'll run this script each time the notification is set to trigger and add to your CC recipients.

Please mark reply as Helpful/Correct, if applicable. Thanks!

 


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

Hi Allen,

Thank you for your reply.

Apologies for not providing complete information

Yes, i am using this in email script and calling it in email template. Email template is used in notification

I tried putting log and it is giving correct value in log but it is not added that value as cc

 

Hi,

Can you please check and confirm 'send to event creator' checkbox is checked on your email notification?

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi,

Did you checked this configuration which I suggested in previous reply?

Also try adding hardcoded email for testing.

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande