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

Notifications

Announcements

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

(7) ShareShare
ReportReport
Posted on by 108
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,396 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,537 Super User 2025 Season 2 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
    96,039 Super User 2025 Season 2 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
    8,764 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,154 Super User 2025 Season 2 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
    4,192 Super User 2025 Season 2 on at
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    21,048 Super User 2025 Season 2 on at
  • Suggested answer
    OussamaSabbouh Profile Picture
    7,070 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 

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,651

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 808 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 718 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans