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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Business Central – How to Add More Buckets to Aged Accounts Receivable Report Extension

(10) ShareShare
ReportReport
Posted on by 120
Hi,
I'm working on extending the default Aged Accounts Receivable report in Business Central. I would like to add more aging buckets to the report using a report extension. Could anyone help me with the required extension code?

Below is the current report format for your reference.
 
 
 
 
 
 
 
 
 
Thank you,
 
I have the same question (0)
  • Gerardo Rentería García Profile Picture
    25,555 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Aged Accounts Receivables (report) - Business Central | Microsoft Learn

    Add aging buckets to your Business Central reports

    Best Regards
    Gerardo

  • Ramesh Kumar Profile Picture
    7,547 Super User 2026 Season 1 on at
    You need to extending the standard report 120 "Aged Accounts Receivable" or app which in app source.
     
    reportextension 50100 "Aged AR Ext" extends "Aged Accounts Receivable"
    {
        dataset
        {
            add(Customer)
            {
                column(Aged91To120: Decimal)
                {
                    Value = CalculateAgedAmount(Rec, 91, 120);
                }
                column(Aged121Plus: Decimal)
                {
                    Value = CalculateAgedAmount(Rec, 121, 99999);
                }
            }
        }
        procedures
        {
            local procedure CalculateAgedAmount(CustRec: Record Customer; FromDays: Integer; ToDays: Integer): Decimal
            var
                CustLedgerEntry: Record "Cust. Ledger Entry";
                DueDate: Date;
                AgedAmount: Decimal;
            begin
                AgedAmount := 0;
                CustLedgerEntry.SetCurrentKey("Customer No.", Open, "Due Date");
                CustLedgerEntry.SetRange("Customer No.", CustRec."No.");
                CustLedgerEntry.SetRange(Open, true);
                if CustLedgerEntry.FindSet() then
                    repeat
                        DueDate := CustLedgerEntry."Due Date";
                        if DueDate <> 0D then begin
                            if (DueDate <= (WorkDate - FromDays)) and (DueDate > (WorkDate - ToDays)) then
                                AgedAmount += CustLedgerEntry."Amount (LCY)";
                        end;
                    until CustLedgerEntry.Next() = 0;
                exit(AgedAmount);
            end;
        }
    }
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Suggested answer
    YUN ZHU Profile Picture
    99,086 Super User 2026 Season 1 on at
    But in addition to the code, the layout file also needs to be updated.
    Hope the following helps as well.
    Report extensibility (ReportExtension Object)
    How to add Media or MediaSet data type (Pictures) to a report
     
    Thanks.
    ZHU
  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    9,112 Super User 2026 Season 1 on at

    Hi,

    The default Aged Accounts Receivable report only calculates a fixed number of buckets, which is why some ranges in your screenshot show as “Not available.” To extend the report with more buckets, you’ll need to modify both the AL logic and the layout.

    Here’s a modular example using reportextension:

    al
    reportextension 50100 "Aged AR Ext" extends "Aged Accounts Receivable"
    {
        dataset
        {
            add(Customer)
            {
                column(Aged91To120: Decimal)
                {
                    Value = CalculateAgedAmount(Rec, 91, 120);
                }
                column(Aged121To150: Decimal)
                {
                    Value = CalculateAgedAmount(Rec, 121, 150);
                }
                column(Aged151To180: Decimal)
                {
                    Value = CalculateAgedAmount(Rec, 151, 180);
                }
                column(Aged181Plus: Decimal)
                {
                    Value = CalculateAgedAmount(Rec, 181, 99999);
                }
            }
        }
    
        procedures
        {
            local procedure CalculateAgedAmount(CustRec: Record Customer; FromDays: Integer; ToDays: Integer): Decimal
            var
                CustLedgerEntry: Record "Cust. Ledger Entry";
                DueDate: Date;
                AgedAmount: Decimal;
            begin
                AgedAmount := 0;
                CustLedgerEntry.SetRange("Customer No.", CustRec."No.");
                CustLedgerEntry.SetRange(Open, true);
                if CustLedgerEntry.FindSet() then
                    repeat
                        DueDate := CustLedgerEntry."Due Date";
                        if DueDate <> 0D then
                            if (DueDate <= (WorkDate - FromDays)) and (DueDate > (WorkDate - ToDays)) then
                                AgedAmount += CustLedgerEntry."Amount (LCY)";
                    until CustLedgerEntry.Next() = 0;
                exit(AgedAmount);
            end;
        }
    }
     

    To make these buckets visible:

    • Update the RDLC, Word, or Excel layout to include the new columns.
    • If using ForNAV, increase the Column Count in the Aged Accounts Arguments table (up to 31 supported) and override the aging logic via OnOverrideCalcdates.
    • For dynamic control, expose Column Count on the request page or set it in OnPreReport.


    The “Not available” ranges in your screenshot are likely caused by the default report only calculating 5 buckets. Extending the logic and layout resolves this.

    Helpful References
    Aged Accounts Receivable Report (Report 120) – Microsoft Learn
    Customer Detailed Aging Report (Report 4402) – Microsoft Learn
    Add Aging Buckets on Aged Accounts Receivables – ForNAV Knowledge Base
    Customizing Report Layouts in Microsoft Dynamics 365 Business Central – Kristen Hosman


    If you find this helpful, feel free to mark this as the suggested or verified answer.

    Cheers
    Jeffrey

  • Suggested answer
    Sohail Ahmed Profile Picture
    11,169 Super User 2026 Season 1 on at
    Maybe this will give you a hint to resolve your problem
     
     
    ✅ Mark this answer as verified if it helps you.
  • Suggested answer
    Andrés Arias Profile Picture
    5,166 Super User 2026 Season 1 on at
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,130 Super User 2026 Season 1 on at
  • RD-11011729-0 Profile Picture
    133 on at
    Hello
     
    I would appreciate some help here ,  I tried using the code suggested above to add additional buckets and the below is the code . I also tried to edit the layout to include the additional fields please see attached . However the report is not populating the additional buckets (Aged91To120 & Aged121Plus fields). 
     
    Thanks in advance 
    reportextension 50100 "Aged AR Ext2" extends "Aged Accounts Receivable"
    {
        dataset
        {
            add(Customer)
            {
                column(Aged91To120; CalculateAgedAmount(Customer, 91, 120))
                {
                }
                column(Aged121Plus; CalculateAgedAmount(Customer, 121, 99999))
                {
                }
            }
        }
     
        local procedure CalculateAgedAmount(
            CustRec: Record Customer;
            FromDays: Integer;
            ToDays: Integer
        ): Decimal
        var
            CustLedgerEntry: Record "Cust. Ledger Entry";
            DueDate: Date;
            AgedAmount: Decimal;
        begin
            AgedAmount := 0;
     
            CustLedgerEntry.SetCurrentKey("Customer No.", Open, "Due Date");
            CustLedgerEntry.SetRange("Customer No.", CustRec."No.");
            CustLedgerEntry.SetRange(Open, true);
     
            if CustLedgerEntry.FindSet() then
                repeat
                    DueDate := CustLedgerEntry."Due Date";
                    if DueDate <> 0D then
                        if (DueDate <= (WorkDate - FromDays)) and
                           (DueDate > (WorkDate - ToDays)) then
                            AgedAmount += CustLedgerEntry."Amount (LCY)";
                until CustLedgerEntry.Next() = 0;
     
            exit(AgedAmount);
        end;
    }
  • Suggested answer
    OussamaSabbouh Profile Picture
    12,965 Super User 2026 Season 1 on at
    Hello,
     
    You can’t really add more aging buckets to the standard Aged Accounts Receivable report using a reportextension because the bucket logic and columns are hard-coded in the base report (arrays + RDLC). A report extension can add fields or layouts, but it can’t expand the number of aging periods. The only workable solution is to copy the standard report into a new custom report, increase the bucket arrays and dataset columns, update the request page if needed, and adjust the RDLC layout to show the extra buckets, then run this custom report instead of the standard one.
     
    Regards,
    Oussama 
  • RD-11011729-0 Profile Picture
    133 on at
    Hello,
     
    Thanks, please could you help me here, I did exactly what Jeffrey suggested about extending aged buckets. Am I missing something here.  How do I copy the standard report into a new custom report. Also would I need to change the AL code that I am using. Appreciate your help
     
    Thank you in advance

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,993 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,116 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans