Is it possible to schedule reports via email body rather than excel/pdf attachment.

mahesh-gupta
Tera Contributor
 
2 ACCEPTED SOLUTIONS

Baala T
Mega Guru

Hi Mahesh,

 

There is a work-around.

 

Entire report should be coded in Notification Script using GlideRecord and template.print. This way we can fulfill your requirement.

 

Few drawbacks also there in it.

- Maintenance would be difficult when there is a need for minor enhancement

- EMail body size will increase 

 

Regards,

Bala T

View solution in original post

SanjivMeher
Kilo Patron
Kilo Patron

As suggested by Bala, notification script can be used to print the table in the email. 

In that case you will have to use a Scheduled script to generate the event. And the event should trigger the notification. the notification should use a notification email script to print the data in the email body. As mentioned, it may increase the email body size if the data is too much.

 

If it is an image, you can specify ${report:png} in the introductory message and set type as Embedded PNG in the Scheduled Report

SanjivMeher1_0-1665657482316.png

 


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

9 REPLIES 9

Baala T
Mega Guru

Hi Mahesh,

 

There is a work-around.

 

Entire report should be coded in Notification Script using GlideRecord and template.print. This way we can fulfill your requirement.

 

Few drawbacks also there in it.

- Maintenance would be difficult when there is a need for minor enhancement

- EMail body size will increase 

 

Regards,

Bala T

Thanks for the insight @Baala T .

Would you help me with the sample draft of GlideRecord to perform above action.

Thanks,

Mahesh.

Hi Mahesh,

Please find below skeleton of the code.

template.print('<table>');
template.print('<tr><td>Number</td><td>Short Description</td><td>State</td></tr>');
var grInc = new GlideRecord('incident');
grInc.addEncodedQuery('<FILTER CONDITION>');
grInc.query();

while(grInc.next()){
	template.print('<tr><td>'+grInc.getValue('number')+'</td><td>'+grInc.getValue('short_description')+'</td><td>'+grInc.getValue('incident_state')+'</td></tr>');
}
template.print('</table>');

 

Regards,
Bala T

SanjivMeher
Kilo Patron
Kilo Patron

As suggested by Bala, notification script can be used to print the table in the email. 

In that case you will have to use a Scheduled script to generate the event. And the event should trigger the notification. the notification should use a notification email script to print the data in the email body. As mentioned, it may increase the email body size if the data is too much.

 

If it is an image, you can specify ${report:png} in the introductory message and set type as Embedded PNG in the Scheduled Report

SanjivMeher1_0-1665657482316.png

 


Please mark this response as correct or helpful if it assisted you with your question.

Thanks for the details @SanjivMeher