Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Customer Name in ledger entry table - AL Code

(0) ShareShare
ReportReport
Posted on by 190

Dear all,

Am trying to bring Customer Name from  Cust. Ledger Entry (21) to the Detailed Cust. Ledg. Entry (379). Right now only customer num is available in Detailed Customer Ledger Entry Page.

but am stuck in the code, pls correct if am doing wrong

pageextension 60022 "CusName DetailCustLed Entry" extends "Detailed Cust. Ledg. Entries"
{
    layout
    {
        addafter("Customer No.")
        {
            field("Customer Name"; CustomerName)
            {
                ApplicationArea = All;
                Caption = 'Customer Name';
            }

        }
    }
    TRIGGER OnAfterGetRecord();
    

    BEGIN
        clear(CustomerName);

        IF Rec."Entry No." = Rec."​Cust. Ledger Entry No."::"Cust. Ledger Entry" THEN BEGIN
            TempCustLedEntry.RESET;
            TempCustLedEntry.DELETEALL;
            DetailedCustomerLedgerEntries.GetGLEntries(Rec, TempCustLedEntry);
            TempCustLedEntry.findfirst;
            CustomerName := TempCustLedEntry."Customer Name";

        END;
    END;



    var
        CustomerName: Code[50];

         TempCustLedEntry: Record "Cust. Ledger Entry" temporary;
         DetailedCustomerLedgerEntries: Codeunit DetailedCustomerLedgerEntries;
}

  • LearnBC Profile Picture
    LearnBC 190 on at
    RE: Customer Name in ledger entry table - AL Code

    Thanks Nitin. its works as expected.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Customer Name in ledger entry table - AL Code

    Hi LearnBC ,

    Please change your code as per below, and see if it fulfill your requirement.

    pageextension 60022"CusName DetailCustLed Entry" extends "Detailed Cust. Ledg. Entries"

    {

       layout

       {

           addafter("Customer No.")

           {

               field("Customer Name"; CustomerName)

               {

                   ApplicationArea = All;

                   Caption = 'Customer Name';

               }

           }

       }

       TRIGGER OnAfterGetRecord();

       var

           Customer: Record Customer;

       BEGIN

           clear(CustomerName);

           if Customer.get(rec."Customer No.") then

               CustomerName := Customer.Name;

           // IF Rec."Entry No." = Rec."Cust. Ledger Entry No."::"Cust. Ledger Entry" THEN BEGIN

           //     TempCustLedEntry.RESET;

           //     TempCustLedEntry.DELETEALL;

           //     DetailedCustomerLedgerEntries.GetGLEntries(Rec, TempCustLedEntry);

           //     TempCustLedEntry.findfirst;

           //     CustomerName := TempCustLedEntry."Customer Name";

           // END;

       END;

       var

           CustomerName: Code[50];

       // TempCustLedEntry: Record "Cust. Ledger Entry" temporary;

       // DetailedCustomerLedgerEntries: Codeunit DetailedCustomerLedgerEntries;

    }

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

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans