[Extensibility Enhancement] - CU8800 OnBeforeRunReportWithCustomReportSelection
We need to add ReportSelections as a parameter to the event OnBeforeRunReportWithCustomReportSelection in Codeunit 8800 Custom Layout Reporting. This will pass the existing global variable ReportSelections, so shouldn't be a var.
This is because at this point we need to know what the Usage is for this report, which we can't get with the current parameters.
This is quite urgent.
local procedure RunReportWithCustomReportSelection(var DataRecRef: RecordRef; ReportID: Integer; var CustomReportSelection: Record "Custom Report Selection"; EmailPrintIfEmailIsMissing: Boolean)
var
CustomReportLayoutCode: Code[20];
IsHandled: Boolean;
begin
OnBeforeRunReportWithCustomReportSelection(
//<< NEW
// OLD - DataRecRef, ReportID, CustomReportSelection, EmailPrintIfEmailIsMissing, TempBlobIndicesNameValueBuffer, TempBlobList,
DataRecRef, ReportID, ReportSelections, CustomReportSelection, EmailPrintIfEmailIsMissing, TempBlobIndicesNameValueBuffer, TempBlobList,
//>> NEW
OutputType, AnyOutputExists, IsHandled);
if IsHandled then begin
CustomReportSelection.Validate("Report ID", ReportID);
LogAndClearLastError(CustomReportSelection."Report Caption", DataRecRef.RecordId);
exit;
end;
You have field Usage in table Custom Report Selection, no need to add parameters.
When this function is called from the RunReport function, it passes a blank CustomReportSelection, so we do not then know the usage.
If adding a parameter is not an option, can you instead change this function to assign the Usage on CustomReportSelection from the global ReportSelection, before the event is called?
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.