Blog

How to create a Report Extension to add a field to the dataset of a Report

How To Create A Report Extension To Add A Field To The Dataset Of A Report

Overview

In the report extension, you can extend existing reports, similar to tables and pages.

Some of the features in the report extension –

Adding columns to the existing Dataitem.

Adding new Dataitem.

Adding a new layout file which reflects with new fields of report extension.

Adding fields in the request page.

For instance:

Let’s add a field in the Sales Invoice NA report 10074.

Add a field [HalfQty] in the existing report.

First, we need to create new “al file” for report extension. In the file, we can use report extension snippet “treportext” to create report extension object.
Then we give ID and NAME for our report extension object and add a field [HalfQty] in the dataset.

Report extension layout:
Next step is to add a layout file to the report extension. Because when we add the property [Rdlc Layout / Word Layout] to report extension, then it automatically creates a layout file of report extension, which will be empty, so we will not use this recreated file, but instead we will use a base layout file.
So, how to find a base layout file!
We need to go to “Business Central” and search the “Report Layout Selection” page and then filter it on “REPORT ID[10074]” as shown below.

Now we will add a new “Custom Layout” for the report, that’s a copy of Built-In Layout (Same as shown in below):

Click on the “Custom Layouts” and Open the Page then select the “New”.


Once when we click on “OK”, It will Create a copy of Build-In Layout. (As shown on above).
Now we can “Export” it (As shown in below).

Then file [.rdlc] is download and now we need to the move exported file [Copy of Build-In Layout] in our Vs-Code project folder and rename it to “SalesInvoiceNAExt.rdlc” (As per choice):

And now we are adding our field in the layout file. So, we will Compile “Ctrl+Shift+B” in the project, then new added field “HalfQty” in the dataset of the report extension will also be added in the rdlc layout.
When we open the rdlc layout in Vs-Code, we will have the updated dataset and Copy of Build-In layout:

Next, we need to publish the project [App] in BC.
Update the New [Copy of Build-In] Layout in Business Central:
Now we will again open the “Report Layout Selection” page and deploy our new layout in Business Central.
Go to “custom layout page” then “Import Layout” and after import then Update it (as shown in below):


After updating, the layout is showed in the page, set this layout as a default layout in this page because the layout of report extension is not updated automatically.
Always make sure to choose “Default Report Layout”, once done, then test it.

For more details kindly visit our LinkedIn page:

https://www.linkedin.com/company/allgrow-technologies-pvt-ltd/mycompany/

or you can write us on  contact@allgrowtech.com


Facebook

Twitter

LinkedIn

Advanced Report Extension Techniques in Business Central (AL)

Report extensions (reportextension) allow developers to customize standard Business Central reports without duplicating the underlying base object. This guarantees that your modifications remain fully compatible with Microsoft monthly wave updates.

Production AL Code: Adding Dataset Columns & Request Page Filters

The following AL snippet demonstrates extending Report 1306 (Standard Sales - Invoice) to add custom line fields and user-selectable request page toggles:

reportextension 50130 "ALGT Standard Sales Inv Ext" extends "Standard Sales - Invoice"
{
    dataset
    {
        // Add fields to the Line data item
        add(Line)
        {
            column(ALGT_Serial_Tracking_No; "ALGT Serial Tracking No.")
            {
            }
            column(ALGT_Country_Of_Origin; "ALGT Country Of Origin")
            {
            }
        }
    }

    requestpage
    {
        layout
        {
            addafter(DisplayAdditionalFeeNote)
            {
                field(IncludeTrackingDetails; IncludeTrackingDetails)
                {
                    ApplicationArea = All;
                    Caption = 'Include Serial Tracking Details';
                    ToolTip = 'Specifies whether to print serial tracking numbers on invoice line items.';
                }
            }
        }
    }

    var
        IncludeTrackingDetails: Boolean;
}

Crucial Best Practices When Extending Report Datasets

  • Layout Synchronization: When adding columns to standard reports, always export the default RDLC or Word layout package from the Report Layouts page in Business Central to reference the newly added dataset fields.
  • Performance (Data Set Bloat): Avoid adding heavy calculated FlowFields directly in nested data item loops without proper caching; use global variables and populate them in OnAfterGetRecord only when necessary.
  • Multi-Language Captions: Always declare IncludeCaption = true; on dataset columns if field labels need automatic translation for international trade documents.

Looking for Custom ERP Reporting & Power BI Modernization?

Allgrow Technologies designs enterprise financial reporting suites, high-precision document print layouts, and real-time Power BI data semantic models for Business Central. Explore our Business Central Practice or connect with our US team for reporting support.

Connect with Allgrow Technologies

100% Free · No Obligation

Need an Objective Architecture or Code Assessment?

Discuss your Dynamics 365, Business Central, or Power Platform environment in a free 30-minute session with our senior engineers.

Get a Free 30-Minute Review →