Simple report email

I have been trying to send a report through email through a button even the simplest form hasn’t worked. I dont get any error and that’s the most annoying part of. Here is my simple code just as the manual

system.report.executeAndDistribute(path=‘reports/COfAReport’, action= “email”,
actionSettings = {“to”:[“innwogu@jcomp.com”], “smtpServerName”:“10.14.22.50:25”, “from”:"proces@comp.com", “subject”:“Production Report”})

What am I doing wrong?

Also, is there a way to access pdf files saved in the gateway through the designer and client. Seems like when I used system.file functions, it is accessing the clients computer not the gateway. Thanks.

I resolved this using another method. I sill need answer to second question. Thanks.

Check in the gateway logs (Gateway webpage -> Status -> Diagnostics/Logs).

That’s correct - exposing the filesystem of the gateway to all clients would be rather dangerous. The usually recommended approach is to store generated .PDFs as binary data (BLOBs) in a database table. Then clients can simply run a SQL query and use the PDF viewer component’s loadPDFBytes

Another approach is to use message handling/system.util.sendRequest so that the client requests a particular report/filename, then a gateway message handler runs and response with a byte array using system.file.readFileAsBytes.

Thanks a bunch. I thought there could be away to give some form of privilege to users in other for that. Any, the database idea is a good one. Thanks again.

Do you have an SMTP profile set up already? It looks like you might be putting the IP address and port of your SMTP server in rather than the name of the SMTP profile.

1 Like