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...
Answered

Getting field from General Ledger to Cust. ledger Entries

(0) ShareShare
ReportReport
Posted on by 25

I have created new field in General Ledger (Description2) and also created the same field in Cust. Ledger Entries now when posting I want to get the value of Description2 from the General Ledger to the Cust. Ledger Entries 

I did some research and found that I should use some code Unites but they did not mention them , can someone please help to get any idea about doing this, it will be much appreciated. 

  • Suggested answer
    YUN ZHU Profile Picture
    104,157 Super User 2026 Season 2 on at

    Hi, you can use the event in Codeunit.

    For example:

    codeunit 50100 MyCodeunit
    {
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnAfterPostSalesDoc', '', false, false)]
        local procedure UpdateDescription2(var CustLedgerEntry: Record "Cust. Ledger Entry"; var SalesHeader: Record "Sales Header")
        var
            Cust: Record Customer;
        begin
            if Cust.Get(SalesHeader."Sell-to Customer No.") then begin
                CustLedgerEntry.Description2 := Cust.Description2;
                CustLedgerEntry.Modify();
            end;
        end;
    }

    But if you only want to display the data on the Customer without any processing, the easiest way is to use flowfield.

    Customer:

    tableextension 50100 ZYCustomerExt extends Customer
    {
        fields
        {
            field(50100; Description2; Text[100])
            {
                Caption = 'Description 2';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50100 ZYCustomerCardExt extends "Customer Card"
    {
        layout
        {
            addlast(General)
            {
                field(Description2; Rec.Description2)
                {
                    ApplicationArea = All;
                }
            }
        }
    }

    pastedimage1629418630573v1.png

    Customer Ledger Entries:

    tableextension 50101 ZYCustLedgerEntryExt extends "Cust. Ledger Entry"
    {
        fields
        {
            field(50100; Description2; Text[100])
            {
                Caption = 'Description 2';
                FieldClass = FlowField;
                CalcFormula = lookup(Customer.Description2 where("No." = field("Customer No.")));
            }
        }
    }
    
    pageextension 50101 ZYCustLedgerEntriesExt extends "Customer Ledger Entries"
    {
        layout
        {
            addafter(Description)
            {
                field(Description2; Rec.Description2)
                {
                    ApplicationArea = All;
                }
            }
        }
    }

    pastedimage1629418663011v2.png

    Hope this will help.

    Thanks.

  • MapMd Profile Picture
    25 on at

    it gives an error on the codeunit on the CustLedgerEntry.

    this is the error "The member referenced by event subscriber 'UpdateDescription2' parameter 'CustLedgerentery' is not found"

  • Verified answer
    YUN ZHU Profile Picture
    104,157 Super User 2026 Season 2 on at

    Sorry, I only tested it in the BC18.3 W1 version, if you are in another version, I hope you can refer to it.

    pastedimage1629449068594v2.png

    pastedimage1629448954134v1.png

  • MapMd Profile Picture
    25 on at

    I solved this by using "Gen. Jnl.-Post Line" codeunit, I did not use customer table, just assigned the Description2 in the cust ledger entry directly from General journals. Thank you so much for the help

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 624 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 440 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 244 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans