Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Customer Name in ledger entry table - AL Code

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,023 Moderator 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans