Attaching a report to an email notification

Jamsta1912
Tera Guru

Hi all,

There's a reference in the docs to attaching reports to email notifications:

https://docs.servicenow.com/bundle/kingston-servicenow-platform/page/administer/notification/concept...

The syntax to use is

${report:X:Y}

I'd assumed this needs to go in an email script, but the script editor doesn't like the syntax. I've tried putting it in the message HTML of the actual notification, but in that case the email fails to send and there is a very meaty error message appearing in the logs that begins:
'For input string: "reportID": java.lang.NumberFormatException: For input string: "reportID": java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) java.lang.Integer.parseInt(Integer.java:580) '...

Does anyone have any thoughts on this?

Jamie

 

8 REPLIES 8

Brian Lancaster
Tera Sage

That looks like it would go into the HTML section.  Are you putting one of these "reportID, gaugeID, dashboardID, or chartID" in for x and replacing y with the report sys_id?

Chuck Tomasi
Tera Patron

Brian is right, it goes in the Message HTML section. Can you share your latest attempt?

example

${report:reportID:SYS_ID_OF_REPORT}

Get the report from going to Reports> Administration> All, locate the name of the report, open it, and use the form menu to copy the sys_id.

Brian Lancaster
Tera Sage

I got it to work doing this.

${report:reportID:01a8f532df01110068c37a0d3df2635a}  

Nate there are not quotes around the reportID or sys_id.

Jamsta1912
Tera Guru

Hi Brian and Chuck,

Thank you both for your input. I'm putting ${report:reportID:0ca66956db1c630092211fc7689619c3} into the Message HTML but I'm still getting the error message. The sys_id is the sys_id of an existing report.

The notification fires OK when the message HTML is just the actual content of the email body. But to be sure the other content wasn't somehow interfering, I've stripped it out so that it's just the ${report:reportID:0ca66956db1c630092211fc7689619c3} part. I've attached a screenshot of the notification as it now is, and another showing a part of the error log.

Jamie