Skip to content

Triggering an Order Report to be generated and emailed automatically as part of a process (like when a sales quotation's approval completes) works for generating the report via archive_api.new_client_report, but the generated PDF isn't available to attach to an email within that same PL/SQL block — and separately, is there a way to combine multiple generated reports into a single email rather than getting one email per report?

Answer

Report PDF generation is asynchronous, so the generated PDF genuinely isn't available yet within the same PL/SQL block that triggered it — instead, hook the standard PDF_REPORT_CREATED event, which fires once the PDF generation has actually completed, and build your email-sending logic (using command_sys.mail with the generated report as the attachment) inside that event instead of trying to send immediately after triggering generation. Since PDF_REPORT_CREATED fires once per individual report, if you need several reports combined into a single email, use a Report Rule with the 'Route to Connect' action type to save each report's PDF to a known path on the application server first, then separately trigger one email afterward (from a custom menu PL/SQL action or a background job) that attaches each of the saved report files by their file paths, rather than relying on PDF_REPORT_CREATED's one-event-per-report firing pattern to build a combined email.

← Browse Developer Studio, deployment, and upgrades questions