ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Event OnFetchReportLayoutByCode missing

Open CyrilleJsmt opened this issue 5 months ago • 11 comments

Why do you need this change?

Create event to modify the layout state before printing but after a runmodal with the new method (Report Layout List 2000000234)

Describe the request

In CU44, there's a "FetchReportLayoutByCode" function to modify the layout before printing but after a runmodal. Use with the old "Custom Report Layout". I can call a custom report before launching a report.

    [EventSubscriber(ObjectType::Codeunit, Codeunit::ReportManagement, OnFetchReportLayoutByCode, '', false, false)]
    local procedure OnFetchReportLayoutByCode(ObjectId: Integer; LayoutCode: Text; var TargetStream: OutStream; var IsHandled: Boolean)
    var
        CustomReportLayout: Record "Custom Report Layout";
        TempBlobIn: codeunit "Temp Blob";
        TempInStream: InStream;
        lSingleInstance: Codeunit "NVW NaviWest SingleInstance";
    begin
        LayoutCode := lSingleInstance.GetLayout();
        if not CustomReportLayout.Get(LayoutCode) then
            LayoutCode := '';

        if LayoutCode <> '' then begin
            CustomReportLayout.GetLayoutBlob(TempBlobIn);
            TempBlobIn.CreateInStream(TempInStream);
            CopyStream(TargetStream, TempInStream);
            IsHandled := true;
        end;
    end;

With the new method (Report Layout List 2000000234), is it possible to create a "OnFetchReportLayoutByCode" event to modify the layout state before printing but after a runmodal ? I haven't found a solution.

CyrilleJsmt avatar Jun 26 '26 08:06 CyrilleJsmt

Hi @CyrilleJsmt,

Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.

📚 Extensibility Guidelines

Missing Information:

  • proposed_code_change: Provide the exact base code addition or modification with surrounding context showing where in the new report layout flow the event should be published.

Please update the issue with the missing details. We'll automatically re-analyze once updated.

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

github-actions[bot] avatar Jun 26 '26 13:06 github-actions[bot]

proposed_code_change: CU codeunit 2000000005 "Reporting Triggers"

Image

// After runmodal report and before printing, in option report, fetching a new layout Name by AL code. ///

/// Business event that allows layout selection through a user interface, primarily used by the "Report Layouts" extension. /// /// The ID of the report object. /// The name of the selected layout. /// The GUID of the app that provides the layout. /// Indicates whether the layout selection was successful. /// /// This event enables UI-based layout selection and is primarily used by the first-party "Report Layouts" extension to provide a user-friendly layout selection experience. /// [BusinessEvent(false)] procedure FetchReportLayoutUI(ObjectId: Integer; var LayoutName: Text; var LayoutAppID: Guid; var Success: Boolean) begin end;

CyrilleJsmt avatar Jul 07 '26 10:07 CyrilleJsmt

Hi @CyrilleJsmt,

Thank you for your extensibility request.

A similar event already exists in this location that may serve your purpose:

Existing event: OnAfterSelectReportLayoutUI

[IntegrationEvent(false, false)]
local procedure OnAfterSelectReportLayoutUI(ObjectID: Integer; var LayoutName: Text; var LayoutAppID: Guid; Success: Boolean)
begin
end;

Location: ReportManagement.Codeunit.al

Would this existing event work for your scenario? If not, please explain why a new event is needed.

Please respond with confirmation or additional details. We'll re-analyze once you respond.

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

github-actions[bot] avatar Jul 07 '26 13:07 github-actions[bot]

The Event OnAfterSelectReportLayoutUI must be call BEFORE a RUNMODAL report. Whereas I want to modify my layout AFTER the runmodal. With the old "Custom Report Layout" method, the OnFetchReportLayoutByCode event handled this very well !

I need a FetchReportLayoutUI event that works with the new "Report Layout List" method, as I explained just above.

Since you do not understand my request, I will phrase it more simply: how do I modify a report's layout using AL code once the report has been launched ?

Image

CyrilleJsmt avatar Jul 10 '26 14:07 CyrilleJsmt

Hi @CyrilleJsmt,

Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.

📚 Extensibility Guidelines

Missing Information:

  • proposed_code_change: Provide the exact base code addition or modification with searchable surrounding context showing where the new event should be published in the new report layout flow.

Please update the issue with the missing details. We'll automatically re-analyze once updated.

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

github-actions[bot] avatar Jul 10 '26 19:07 github-actions[bot]

proposed_code_change: CU codeunit 2000000005 "Reporting Triggers"

Image

// After runmodal report and before printing, in option report, fetching a new layout Name by AL code. ///

/// Business event that allows layout selection through a user interface, primarily used by the "Report Layouts" extension. /// /// The ID of the report object. /// The name of the selected layout. /// The GUID of the app that provides the layout. /// Indicates whether the layout selection was successful. /// /// This event enables UI-based layout selection and is primarily used by the first-party "Report Layouts" extension to provide a user-friendly layout selection experience. /// [BusinessEvent(false)] procedure FetchReportLayoutUI(ObjectId: Integer; var LayoutName: Text; var LayoutAppID: Guid; var Success: Boolean) begin end;

CyrilleJsmt avatar Aug 03 '26 09:08 CyrilleJsmt

Hi @CyrilleJsmt,

Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.

📚 Extensibility Guidelines

Missing Information:

  • proposed_code_change: Provide the exact base code addition or modification with searchable surrounding context showing precisely where in codeunit 2000000005 "Reporting Triggers" the new event should be published in the new report layout flow.

Please update the issue with the missing details. We'll automatically re-analyze once updated.

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

github-actions[bot] avatar Aug 03 '26 13:08 github-actions[bot]

/not-accurate I've already suggested a code

CyrilleJsmt avatar Aug 27 '26 07:08 CyrilleJsmt

✅ Feedback recorded Thanks — your /not-accurate feedback has been logged and will be reviewed.

github-actions[bot] avatar Aug 27 '26 07:08 github-actions[bot]

Hello @CyrilleJsmt,

Would it be suitable for your scenario if we add a new event,  OnAfterGetSelectedReportLayout , in the  SelectReportLayoutCode  procedure of codeunit 44  Report Management ?

The event would be called after the current layout has been resolved but before it is returned to the reporting runtime:

SelectedLayoutName := DesignTimeReportSelection.GetSelectedLayout();
SelectedAppID := DesignTimeReportSelection.GetSelectedAppID();

if SelectedLayoutName = '' then
    if ReportLayoutSelection.Get(ObjectId, CompanyName) and
       (ReportLayoutSelection.Type = ReportLayoutSelection.Type::"Custom Layout")
    then
        SelectedLayoutName := ReportLayoutSelection."Custom Report Layout Code";

OnAfterGetSelectedReportLayout(ObjectId, SelectedLayoutName, SelectedAppID);

if (SelectedLayoutName <> '') and
   (StrLen(SelectedLayoutName) <= MaxStrLen(CustomReportLayout."Code"))
then
    ...

The new event would be:

[IntegrationEvent(false, false)]
local procedure OnAfterGetSelectedReportLayout(
    ObjectId: Integer;
    var LayoutName: Text[250];
    var LayoutAppID: Guid)
begin
end;

This would allow subscribers to replace both the layout name and its application ID during late layout resolution and would support layouts from the new  Report Layout List  flow.

AleksandricMarko avatar Oct 12 '26 16:10 AleksandricMarko

As this repo will be archived in few days, I will close the issue. In case you still need proper event request, please create new issue as part of BCApps repo (https://github.com/microsoft/BCApps/issues)

AleksandricMarko avatar Oct 16 '26 09:10 AleksandricMarko