ADVERTISEMENT
AL Objects and Extensibility

Report Extension in AL

Learn what Report Extension in AL is and how it is used to extend standard reports in Business Central without modifying base objects. Understand structure, use cases, and best practices.

What you will accomplish

Use a report extension when a Microsoft or dependency report is already the correct business document and you only need additive dataset, request-page, trigger, or layout changes. Build a new report when ownership and purpose are genuinely different.

Before you start

Identify the exact base report, current layouts, dataitems, and target version. Confirm that the extension point supports the required change.

Expected learning result

You should be able to add one source-backed column, expose it in a controlled layout, and verify that the standard report still runs when the extension is absent.

Report Extension in AL
Report Extension in AL

Report extensions in AL allow developers to customize standard Business Central reports without modifying the original report object. They exist to make reports extensible while preserving upgrade safety, exactly like table extensions and page extensions do for data and UI.

This page explains what report extensions are, why they exist, and how they are used in real implementations, with practical examples. The focus is on extending datasets, adding logic, and adjusting output behavior, not on designing layouts themselves.


Why Report Extensions Exist

Standard reports in Business Central are delivered and maintained by Microsoft. These reports often satisfy most requirements, but real businesses frequently need:

• Additional fields in printed documents
• Extra calculations
• Conditional output behavior
• Minor logic adjustments during report execution

Directly modifying a standard report would:

• Be overwritten during upgrades
• Break compatibility
• Increase maintenance cost

Report extensions exist to solve this problem by allowing safe, additive customization.

What Is a Report Extension?

A report extension is an AL object that extends an existing report at runtime. It does not replace the report and does not create a new one. Instead, it injects additional behavior into the standard report execution pipeline.

A report extension can:

• Add fields to the report dataset
• Add new dataitems
• Add or override report triggers
• Add additional layout files

A report extension cannot:

• Remove existing dataitems
• Redesign standard logic completely
• Replace posting behavior

When You Should Use a Report Extension

You should use a report extension when:

• You need extra data on a standard report
• The standard report logic is mostly correct
• The requirement must survive upgrades
• You want to reuse Microsoft’s report structure

Common examples include:

• Adding custom fields to Sales Invoice printouts
• Including additional totals or notes
• Adding company-specific information to documents

ADVERTISEMENT

Basic Structure of a Report Extension

A report extension is defined using the reportextension object and references the report it extends.

Example: Structure of Report Extension

AL

reportextension 50140 SalesInvoiceExtension extends "Sales - Invoice"
{
}
    

The extends clause identifies the standard report being customized.

Extending the Dataset

One of the most common uses of report extensions is adding fields to the dataset so they can be used in layouts.

Example: Extending Reports

AL

reportextension 50140 SalesInvoiceExtension extends "Sales - Invoice"
{
    dataset
    {
        add(SalesInvoiceHeader)
        {
            column(CustomerCategory; "Customer Category")
            {
            }
        }
    }
}
    

This example:

• Extends the existing dataset
• Adds a custom field from the table
• Makes the field available for layouts

The base report remains untouched.

Adding Calculated Fields to the Dataset

Report extensions can also add calculated columns.

Example: Adding Calculated Fields

AL

dataset
{
    add(SalesInvoiceHeader)
    {
        column(InvoiceYear; Format("Posting Date", 0, ''))
        {
        }
    }
}
    

These calculated fields:

• Are evaluated during report execution
• Do not change stored data
• Are useful for grouping or display logic

Adding Report Triggers in Extensions

Report extensions allow you to add logic using triggers, but this logic must be report-specific and non-destructive.

Example: Report Triggers

AL

trigger OnPreReport()
begin
    // Initialization logic
end;
    

Appropriate uses include:

• Initializing variables
• Preparing temporary buffers
• Controlling conditional output

Core business logic should still reside in codeunits.

ADVERTISEMENT

Adding Additional Layouts (High-Level)

Report extensions can add new layouts without removing standard ones.

Example: Adding Additional Layouts

AL

rendering
{
    layout(CustomInvoice)
    {
        Type = RDLC;
        LayoutFile = 'CustomInvoice.rdl';
    }
}
    

This allows:

• Company-specific layouts
• Country-specific formats
• Customer-specific documents

Layout design itself is a separate topic.

Report Extensions and Upgrade Safety

During an upgrade:

• Standard reports may change
• Report extensions are reapplied
• Custom fields and layouts remain intact

Because extensions only add behavior, they are resilient to platform changes.

Common Beginner Mistakes With Report Extensions

Developers often:

• Try to replace standard logic instead of extending it
• Add heavy business logic in report triggers
• Use report extensions when a new custom report is better
• Forget to add fields to the dataset before using them in layouts

Understanding the purpose of report extensions avoids these issues.

Summary

Report extensions in AL provide a safe and structured way to customize standard reports in Business Central. They allow developers to enhance reporting output and logic while preserving Microsoft’s base functionality and upgrade safety.

A well-designed report extension:

• Adds only required fields
• Keeps logic lightweight
• Uses dataset extensions correctly
• Survives upgrades cleanly

Understanding report extensions completes the reporting customization layer of AL development.

Practical check: Add an extension field to a standard document dataset

A custom delivery reference stored on a sales document must appear on an existing printed document. Add the field through the correct source table extension first.

Steps and evidence to inspect

  1. Extend the base report dataset at the dataitem that actually contains the value.
  2. Add or select an extension-owned layout and place the new dataset element.
  3. Run with populated and blank references, export data-only where available, and compare output before/after disabling the app.

Expected result

The new reference appears only when data exists, standard columns remain intact, and the dataset value can be verified independently of layout formatting.

If the result is different

A blank layout field often means the wrong dataitem, unavailable source value, stale layout, or mismatched element name. Check data-only output before repeatedly editing the layout.

Version and implementation boundary

Standard report datasets and layouts can change across releases. Recompile, re-export layout metadata when necessary, and regression-test pagination and localisation.

Authoritative reference: Microsoft Learn — Report extension object. The scenario and interpretation above are original to ScrutnLearn.

Stay Updated

Get the latest tutorials, tips and resources delivered to your inbox.