How can I add BCC, CC when create/run Scheduled Report ?

Lien Nguyen
Giga Guru

I created a Scheduled Report. But now I want add CC,BCC in scheduled Report.

PLease help me, What have to do ?

Lien
2 ACCEPTED SOLUTIONS

Voona Rohila
Kilo Patron
Kilo Patron

Hi @Lien Nguyen 

Try this : 

You can create email script and add cc/bcc logic  and include that email script in the message part of the scheduled report

Email script :

VoonaRohila_1-1684916747328.png

Scheduled report :

 

VoonaRohila_0-1684916584904.png

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

I can found CC,BBC inforation in Email Log.

CC will stored in field "Copied"

BCC will stored in field "Blind_copied"

LienNguyen_0-1684986790893.png

 

Lien

View solution in original post

5 REPLIES 5

Voona Rohila
Kilo Patron
Kilo Patron

Hi @Lien Nguyen 

Try this : 

You can create email script and add cc/bcc logic  and include that email script in the message part of the scheduled report

Email script :

VoonaRohila_1-1684916747328.png

Scheduled report :

 

VoonaRohila_0-1684916584904.png

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Thanks for your answer. But after run, I can't find CC, BCC information in Email Log. Can you help me?

Lien

I can found CC,BBC inforation in Email Log.

CC will stored in field "Copied"

BCC will stored in field "Blind_copied"

LienNguyen_0-1684986790893.png

 

Lien

Community Alums
Not applicable

Hi @Lien Nguyen ,

I haven't seen a way to do it directly, but you can attach a report to a custom email notification and have a mail script that adds addresses to the bcc field.   To make it work you need to create a new event in the events registry.   The only thing you need to fill in here is an event name (I called mine: spm.sendreport).   Next you need to create an email notification.   You will need to activate the advanced view so that you can change the Send when field to "Event is fired".   Then choose your event name in the Event Name field.

 

  

SandeepDutta_0-1684916850212.png

 



On the What it will contain tab you will need to put these two lines:

 

        ${mail_script:mail_script_name}

 

        ${report:reportID:sys_id_of_report}

 

somewhere in the body of your message.   Change mail_script_name and sys_id_of_report to the name of your mail script that you are about to create and the sys_id of the report you want to send.   You can add whatever other text you want to be included in the message body.



Next you need the mail script to add the bcc fields.   Go to the Notification Email Scripts module and create a new email script.   Make sure the name matches what you put in the body of your email.   You can use any server side scripting you want to generate a list of users, but the key line you need is:

 

        email.addAddress('bcc','email_address,'display_name');

 

You can run that as many times as you want to add as many email addresses as you like.   Just change the email_address and display_name to what you need.



The last piece is to create a schedule job that triggers the event to fire off the notification.   So go to System Definition -> Scheduled Jobs and hit the New button.   Click the link to "Automatically run a script of your choosing".   Give it a name, choose whatever schedule you want, and then add the following line to the "Run this script" field:

 

        gs.eventQueue('spm.sendreport', null, null, null);

 

Change 'spm.sendreport' to whatever you called your event in the event registry.



If you want to get fancier, you can generate the list of email addresses from the scheduled job and pass them as parameters to your event or even send the sys_id of your report in one of the parameters so that you can use the same notification to send different reports from different jobs.



So all that isn't as easy as just picking some users out of a list and adding them to the "To:" field on the scheduled report, but if you really want to send it to a BCC list, this will get it done.