I would like to add the ability for users to schedule reports to run when they like (daily, weekly, hourly, etc.) and send the results via email, preferably without cluttering up the server’s file system with report images.
Has anybody built this functionality before? Any suggestions before I try to design it myself?
Would anybody else find this useful as a Marketplace add-on (if I could figure out how to write one )?
This is totally opinionated business functionality, therefore should be developed separately from the reporting addon, which acts and a tool to develop reports in different formats and not a tool for sending e-mails or storing files.
The request is about “sending emails with attached reports according to some schedule”. The first part is already solved in the Email Templates addon, which provides all the required API, making implementation quite trivial. The second one can be solved by our runtime schedule tasks via the corresponding editor screen. The only problem I see here is that the schedule tasks editor is far away from being user-friendly. It would be great to think towards adding some visual way to define crons like it is done here and here.
To sum up, this functionality is not a part of reporting addon. It can be implemented trivially, using already existing parts. It is very opinionated and not generic, so it might be good to create a separate addon for that, but from my perspective, it would make more sense to improve CUBA scheduler to be more user-friendly instead.
Scheduled Tasks is not a screen for users, it’s a system administrators’s screen.
Therefore it can’t be used by regular managers who would want to set up “daily statistics of previous business day” every morning.
I agree that the scripting/groovy portions would not be useful for a general user. I would make those fields visible/invisible depending on role. Otherwise, it seems pretty close.
No matter what, some user education may be required. E-Mail templates with variables are not for the general user, either. But having the functionality for the people who can learn how to use it is OK.
In the simplest case, the user picks a report, a distribution list of some kind, an output format and a schedule , then saves it. I would make the system default to a subject line and message body of the report name (maybe with a little extra text in the body).
Then you have the problem of parameters. How do you specify those in a generic way? Now the setup is more difficult. The parameters might need to be calculated based on the current date or the logged in user’s account, for example. Back to the groovy boxes, right? Maybe some standard groovy code could be attached to buttons (my user id, today, yesterday, this week, last week, this month, last month, this year, last year, etc.).
This might be a table of parameters with the appropriate groovy included. Developer/admin could edit the table of available parameters. Users would pick from the defined parameter list and then specify a default when necessary.
I am sure that there are plenty of things I’m still missing. Anything else it should have?