ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] OnAfterRunReport Codeunit 44/2000000005 Reporting Triggers

Open SPinkow opened this issue 7 years ago • 3 comments

Hi Dev Team, is it possible to add a global reporting trigger "OnAfterPrintReport" to Codeunit 2000000005 and/or Codeunit 44 with the following parameters?

OnAfterRunReport(ReportID: Integer; ReportAction : 'SaveAsPdf, SaveAsWord, SaveAsExcel, Preview, Print, SaveAsHtml'; RunMode : 'Normal, ParametersOnly, Execute, Print, SaveAs, RunModal'; RequestPageXml : Text; RecordRef : RecordRef; Stream: InStream)

I would like to archive some things that occur when running a report.

First, the option values of the request page and, if possible, the result of the report. Especially the generated print contents of the pdf, word, excel variants are interesting. If these could be transferred in a stream to the event, it would be helpful.

As RecordReference it would be useful to get the record of the first DataItem as parameter. To distinguish the type of call it would be helpful to pass the parameters RunMode and ReportAction as well (as in the events MergeDocument and SubstitureReport).

I would be very grateful for considering this in the future.

SPinkow avatar May 24 '19 10:05 SPinkow

This would be super-helpful! Any news on this one?

RafaelKoch avatar Jun 18 '19 08:06 RafaelKoch

Hi! This idea is in our backlog and we aim to deliver it for the Spring 2020 release. For other suggestions such as this one, please go ahead and post it to our Ideas forum at https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. We're constantly monitoring top Ideas and will consider them for a future release.

atoader avatar Jun 21 '19 06:06 atoader

I too would really like an option to intercept the "stream" when a report.saveaspdf is executed - so that I could do some further processing to the pdf.

Eg. I might want to append something to the PDF file generated. I know I can do that with the OnBeforeMergeDocument in COD9651 - but only a fixed input can be made that swaps the stream. I don't know the record variant at this event.

https://github.com/microsoft/AL/issues/2353

Per default, BC allows to send a posted Sales Invoice by e-mail where it attaches the incoming documents as well the the e-mail. This is quite useful. However, it would be very useful in some cases, if it could be possible to instead merge the invoice.pdf with its PDF attachments found within incoming documents. If we had that event with a stream around the time saveaspdf is executed, it could allow extensions to develop this.

podgaard avatar Sep 20 '19 23:09 podgaard