Skip to content
Dynamics 365 Blog

Updated: Now with links to both NAV 5.0 and NAV 2009 hotfixes

 /Claus Lundstrøm

******

In several partners meetings I have heard this requests over and over again.

Claus, when we are planning an upgrade of Classic reports to RDLC reports, we do not always know which reports are actually being used at the customer site. It would be great to be able to log which reports are used so we know exactly which reports we need to upgrade to RDLC.

Well, if you download below hotfix you will now have the capability to log report usage at a customer site.

Dynamics NAV 5.0: KB2575296

Dynamics NAV 2009: KB2558650
Find links to all NAV 2009 Platform Hotfixes here:
CustomerSource: Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2
PartnerSource: Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2

 

In the following steps I have outlined which steps you need to do to get this log file. Remember above hotfix is required to perform the following steps.

1. Create new table to be used for Log report usage:

clip_image002

OBJECT Table 50000 Report Log
{
OBJECT-PROPERTIES
{
Date=22-06-11;
Time=14:19:58;
Modified=Yes;
Version List=CLAUSL;
}
PROPERTIES
{
}
FIELDS
{
{ 1 ; ;No. ;Integer ;AutoIncrement=Yes;
MinValue=1 }
{ 2 ; ;User ID ;Code50 ;TableRelation=”User Role”.”Role ID”;
CaptionML=ENU=User ID }
{ 3 ; ;Report ID ;Integer ;CaptionML=ENU=Report ID }
{ 4 ; ;Report Name ;Text249 ;FieldClass=FlowField;
CalcFormula=Lookup(AllObjWithCaption.”Object Caption” WHERE (Object Type=CONST(Report),
Object ID=FIELD(Report ID)));
CaptionML=ENU=Report Name }
{ 5 ; ;Date Time ;DateTime }
}
KEYS
{
{ ;No. ;Clustered=Yes }
}
FIELDGROUPS
{
}
CODE
{
BEGIN
END.
}
}

2. Now with the table created for our Report Usage log please open Codeunit 1

3. Open “C/AL Globals”

4. Navigate to ”Functions”

clip_image004

5. Create new function with Name=”OnReportRun”

clip_image006

6. Open Properties and change ID to 120

clip_image008

7. Now open “Locals” and create parameter= ReportId with Type=Integer

clip_image010

8. Select Variables tab and create ReportLog

clip_image012

9. Now all we need is to write the code for this new trigger. Open C/AL Editor and navigate to the end.

10. In OnReportRun write the following code:

ReportLog.”User ID” := USERID;

ReportLog.”Report ID” := ReportId;

ReportLog.”Date Time” := CURRENTDATETIME;

ReportLog.INSERT;

clip_image014

11. Now Restart Classic Client

12. Run a couple of reports

13. And then at last run the Report Log table to see the result:

clip_image016

Yes I’m aware that this solution only works for Classic Reports, and yes I also would like a feature so it’s possible for you to log all objects being used at a customer site. For now we do not get this, but let’s see what the future brings.

/Claus Lundstrøm

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!

Join the conversation

Loading comments...