Modifying Customer Ledger Entries in Business Central

In Business Central, the Customer Ledger Entry table is a protected table. While you can modify certain fields directly by clicking Edit List, customized fields may not be updated through this method, even if they are added to the list for front-end changes.

To update such fields in the Customer Ledger Entry table, you need to subscribe to the appropriate event and assign the desired values programmatically.

Refer to the example code below to see how to subscribe to an event and implement the required changes:
Ex. Updating External Document No.

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Cust. Entry-Edit", 'OnBeforeCustLedgEntryModify', '', false, false)]
local procedure OnBeforeCustLedgEntryModify(var CustLedgEntry: Record "Cust. Ledger Entry"; FromCustLedgEntry: Record "Cust. Ledger Entry")
begin
CustLedgEntry."External Document No." := FromCustLedgEntry."External Document No.";
///New
//CustLedgEntry."new field" := FromCustLedgEntry."new field";
end;

Note: Currently, this approach updates only the Customer Ledger Entry table. If you need to update related tables, you must write separate functions and call them from the event procedure demonstrated above.

Subscribe! so you wont miss latest posts...

Scroll to Top