Is it possible to call a codeunit with codeunit.run and then get the ID of the calling object, in the "OnRun" section?
I know there is a recordRef, but is there a objectref?
Thing is, we have to customize a lot of reports due implementation of a new software.
The idea was, reducing customization by adding just one "codeunit.run"-line to each report.
Looks like this will not work as we have to make var declaration and other steps.
So, thanks anyway.
Based on blog of NAV team for logging report usage through the 1 CU, special trigger 120 (see http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx), I suggest you to modify that trigger and to call your codeunit, sending the report number (you've got ReportID as a variable in OnReportRun trigger in 1st CU).
Hope you've got my idea!
Answers
Codeunit.SetCallingObject(objectID);
Codeunit.RUN;
Where Codeunit is a variable that refers to your Codeunit, not the CODEUNIT system variable.
Thing is, we have to customize a lot of reports due implementation of a new software.
The idea was, reducing customization by adding just one "codeunit.run"-line to each report.
Looks like this will not work as we have to make var declaration and other steps.
So, thanks anyway.
Hope you've got my idea!
Follow my blog at http://x-dynamics.blogspot.com
seems to be a good approach and I will give it a try!