Report logging
Did you know that, every time you run a report, the system executes a function in code unit 1, application management to determine whether the report has a custom layout or only a built-in layout? You can use this to your advantage to implement report usage logging. In the following example, I will demonstrate how you can implement a log table that will keep track of who is running which report at what moment, and also which layout was used to render the report.
First, let's create a log table. The table is named Report Execution Log:
It contains fields which log who is running which report, at what moment, and the type of layout. The table also contains an InsertRecord()
function that you can call to insert a record. Next, you need to open Codeunit 1, Application Management and look for the function named HasCustomLayout()
. You can add the following code there:
Every time a report is executed it will be logged in this table, as you can see in the following screenshot:
This is...