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

Community site session details

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

Add Ext Doc No to Statement

(2) ShareShare
ReportReport
Posted on by 89
I need to add the External Document number from a Sales Order to the Customer Statement. I think I am close.
 
Here is what I have...
 
Any suggestions are appreciated.
 
Thanks.
reportextension 50100 CustomerStatementReportExt extends "Standard Statement"
{
    dataset
    {
        modify(DtldCustLedgEntries)
        {
            column(SalesOrderExternalNo; SalesOrderExternalNo)
            {
                Caption = 'External Document No.';
            }
 
            trigger OnAfterGetRecord()
            begin
                SalesOrderExternalNo := '';
                // Only populate for Sales Orders
                if DtldCustLedgEntries."Document Type" = DtldCustLedgEntries."Document Type"::Order then
                    if SalesHeader.Get(DtldCustLedgEntries."Document Type", DtldCustLedgEntries."Document No.") then
                        SalesOrderExternalNo := SalesHeader."External Document No.";
            end;
        }
    }
 
    var
        SalesHeader: Record "Sales Header";
        SalesOrderExternalNo: Text[100];
}
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    93,256 Super User 2025 Season 2 on at
    Add Ext Doc No to Statement
    Hi, There is no Order in the Document Type of Detailed Customer Ledger Entries. . .Your code cannot be used to get the order. I don't understand why there is no error. Did you add Order Type in your environment?
    Because this is a posted table, you can use the Invoice No. to get the External Document number on the Posted Sales Invoice. There is no problem.
     
     
    Hope this helps.
    Thanks.
    ZHU

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

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,828

#2
Sumit Singh Profile Picture

Sumit Singh 2,617

#3
YUN ZHU Profile Picture

YUN ZHU 1,861 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans