Exporting Report to PDF then emailing result PDF as attachment

I want to create a custom action on a groupTable that does the following in one go:
(1) Generate PDF file for selected record based on an existing report
(2) A persistent record is then created with a FileDescriptor linked to the PDF
(3) And email is sent to a set of recipients with the PDF as attachment

What is the best approach to take ?

1, 2 - use one of the ReportService.createAndSaveReport() methods to generate the report and save its output to the file storage.
3 - use Email sending API to send email with attachments loaded from the file storage using FileLoader.

2 Likes