Adding custom editable fields on the Customer Ledger Entry

  1 minute read

This is asked on the BC forum, so I thought of showing the steps for adding a custom field on the Cust. Ledger Entry table. Adding an editable field on this table is not straight forward as compared to other tables because MS limits fields which are editable on this table and they use the same kind of logic even for other entry or posted table like for ex: Sales Shipment Header.

To add a new field we will create a new table extension like below

tableextension 50005 "SKK Cust. Ledger Entry" extends "Cust. Ledger Entry"
        field(50001; "Reference No."; Code[50])
            DataClassification = CustomerContent;

This is easy but when you add this field on the cust. ledger entries page, it shows that you can edit but when you input the value and leave the record that value is not saved.

Customer Ledger Entries

To save the value, you need to add another change. You need to subscribe to an event in the codeunit Cust. Entry-Edit called OnBeforeCustLedgEntryModify and then assign the new field value.

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Cust. Entry-Edit", 'OnBeforeCustLedgEntryModify', '', false, false)]
    local procedure "Cust. Entry-Edit_OnBeforeCustLedgEntryModify"(var CustLedgEntry: Record "Cust. Ledger Entry"; FromCustLedgEntry: Record "Cust. Ledger Entry" )
        CustLedgEntry."Reference No." := FromCustLedgEntry."Reference No.";

Customer Ledger Entries

I hope this is helpful.

Thank you for following me. :pray:


Leave a comment