web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

Use 1 Report to display multipple layouts

(0) ShareShare
ReportReport
Posted on by 5

Hi! 

I wrote Report extension for my "Standard Sales - Order Conf." Report.

Now, i want to use this report dataset to display its data in multiple report layouts.

For this cause, im using "rendering" section to add different layouts:

[In Report Extention]

rendering
    {
        layout("My Sales Order Confirmation")
        {
            Type = RDLC;
            LayoutFile = 'My Sales Order Confirmation.rdl';
        }
        layout("My Sales Order Confirmation Email Text")
        {
            Type = Word;
            LayoutFile = 'My Sales Order Confirmation Email Text.docx';
        }

        layout("My Sales Draft Invoice")
        {
            Type = RDLC;
            LayoutFile = 'My Sales Draft Invoice (for Sales Order).rdl';
        }
    }

No i can open my "Sales Order" record on list page and press "Print Confirmation...", where i would be able to select layout. That works.

Now, i want to create another button, so i could open a report right with needed layout, which should be for instance "My Sales Draft Invoice" (from code above). And this is where struggle begins.

I created a page extension and added a button, but i cant set filter on which layout to display. Can you help me with this? 

One method i found is to manually upload layout to "Custom Report Layouts" and write this code on the button:

pageextension 50350 SalesOrderListReportExt extends "Sales Order List"
{
    actions
    {
        addfirst(reporting)
        {
            action(DraftInvoice)
            {
                Caption = 'Draft Invoice';
                ApplicationArea = All;

                trigger OnAction()
                var
                    ReportLayoutSelection: Record "Report Layout Selection";
                    Layout: Record "Custom Report Layout";
                    DraftInvoiceLayoutCode: Code[40];
                    SalesHeader: Record "Sales Header";
                begin
                    SalesHeader.Reset();
                    CurrPage.SetSelectionFilter(SalesHeader);

                    DraftInvoiceLayoutCode := '1305-000008';
                    ReportLayoutSelection.SetTempLayoutSelected(DraftInvoiceLayoutCode);
                    Report.Run(Report::"Standard Sales - Order Conf.", true, true, SalesHeader);
                end;
            }
        }
        addfirst(Category_Category8)
        {
            actionref(DraftInvoice_Promoted; DraftInvoice)
            {
            }
        }
    }
}

 

The problem here is, that if i want to change my layout, i would need to manually upload it back to BC instead of letting VSCode handle it. Do you have a solution for me?

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,344 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,742 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,231

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans