Turn Report Selections into a Selection Dialog
Here is a small trick that I have used a couple of times to turn the report selections into a selection dialog in Microsoft Dynamics NAV.
The report selection table in Dynamics NAV is used to specify what report(s) to run when a user prints a document such as an order confirmation. Part of the report selection functionality is the ability to define more than one report to print at the same time; you can for example have Dynamics NAV print three different documents when the user prints an order confirmation. This is done by listing the reports in the reports selection table in a defined sequence.
If you don’t want to print all the reports each time, but instead display a dialog where the user selects which one to print, then this is quite easy to accomplish with a small tweak.
Here is an example of how it can be done. We start with adding a SelectionDialog function to the Document-Print codeunit (229). The SelectionDialog function will use the report selection records to display a selection dialog for the user (only if more than one report is listed) and then apply a filter in the report selection table on the sequence field based on what option the user selected.
The SelectioDialog function is then simply called before the reports are run in the different functions in the Document-Print codeunit.
The result of this then looks like below.
This way you can setup multiple versions of reports for each document and have the users select what version to print using the dialog. It could for example be different order confirmations depending on what type of order or customer it is.
A small trick that I have found very useful a couple of times.
The above modified codeunit is available in the downloads section (use it on your own risk 🙂 ).