
Hello Philomaths,
Today,I came with widely used feature of business central.Contrary to pages and tables, extensibility is not yet supported for report objects in Business Central. Therefore, if you want to make any changes to the dataset or the layout of a base application report, you must create a new version of the report and apply the changes on the new object. Then you can override the base report with your own customized version by subscribing to the OnAfterSubstituteReport event published by Codeunit 44 – ReportManagement.
the concept is to replace a report for another report through out the Business Central / Dynamics NAV.
In following example , we replace standard “Assembly order ” report with our custom “Assembly Order New” report . Here we just need to subscribe an event and apply Report ID as parameter.
codeunit 50102 “Substitute Report”
{
[EventSubscriber(ObjectType::Codeunit, Codeunit::ReportManagement, ‘OnAfterSubstituteReport’, ”, false, false)]
local procedure OnSubstituteReport(ReportId: Integer; var NewReportId: Integer)
begin
if ReportId = Report::”Assembly Order” then
NewReportId := Report::”Assembly Order New”;
end;
}
When the “OnAfterSubstituteReport” event is raised, the event subscriber method is called and the replacement takes place.
So, When you run “Assembly Order” report through below action , this OnAfterSubstituteReport event raised and New custom report runs. This is what you want to do.
The OnAfterSubstituteReport event is raised when The user activates a page action that runs the report to be substituted, that is, an action that has the RunObject Property set to the report.
That’s all. Thanks for reading , I hope I explain well enough to understand the concept even though need any help contact me at my email Sagar@madhda.com