Scheduling reports question

Would it be possible to schedule a report from a script, that would be emailed to a specified email address(s)?
Then would it be possible to run that script via URL, where the report parameters would be passed in on the URL?

If this is possible, any example script code available to teach how?

Just in case, By Schedule I mean setup for a report to run at a time in the future. Not immediately.

Hi hlynch,

for scheduling a report from a script to email, you can use either SendTo: https://reportserver.net/en/guides/script/chapters/Send-To/ or, better: script datasinks: https://reportserver.net/en/guides/script/chapters/Script-Datasinks/
Both support scheduling, so you have the standard scheduler functionality from RS.

For running reports from URL: https://reportserver.net/en/guides/admin/chapters/Executing-Reports-via-the-URL/
For running scripts from URL: https://reportserver.net/en/guides/script/chapters/Basics/ (3.2. Executing Scripts via URL)

So you can write a script that is callable from an URL, passing any parameters necessary. This script may execute your report and send it via SendTo or via script datasink (or via a simple email datasink https://reportserver.net/en/guides/admin/chapters/Datasinks/ ) to the Email address(s).
If you don’t want to send it immediately, as you say, you can also schedule execution e.g.: https://github.com/infofabrik/reportserver-samples/blob/main/src/net/datenwerke/rs/samples/maintenance/variantScheduler.groovy

Regards,
Eduardo

Hello,

I have a question about the SentTo, I read the documentation :
https://reportserver.net/de/dokumentation/scripting-guide-4-6-1/13-send-to

But I do not understand were the scripts need to be placed.

Thanks,

regards,

Geoffrey

Hi Geoffrey,

please have a look at Hooks Basics and Registering Hooks

TL;DR:

you can execute the script => hook exists until your reportserver is restarted
you can add “onStartup.d” => hook is registered on each start of the reportserver (just like executing it by hand while your reportserver is running)

Hi Felix,

Thanks for you feedback, it’s now clear for me. I tested and work fine.
However another question: why I have this strange layout with your example:

datasink

The Check Box is behind and there is a line separator Between “Mail:” and “Email adress”

Thanks,

regards,

Geoffrey

Hello,

By the way there is another problem with this, as soon the sendto script is executed (still with your unmodified sendToEmailScheduling.groovy example script) when a try to Edit a Schedule(no matter which one) and click on Next I have the following error displayed:

“(TypeError) : Cannot read properties of null (reading ‘b’)”

datasink

As soon as I restart RS, I have no more the error.

Thanks,

Regards,

Geoffrey

Hi Geoffrey,

we raised RS-8647 for looking into this.

Regards,
Eduardo

Hello,

Did you make any progress on this issue ?

Thanks,

regards,

Geoffrey