Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Transferring custom fields form Gen. Journal Line to General Ledger Entries, Custom Ledger Entries and Vendor Ledger Entries

(0) ShareShare
ReportReport
Posted on by 241

Hi Experts,

I hope you all are doing well.

There is a custom field, Field Name "Narration" and Field Id 50000 in Table "Gen. Journal Line' (81). After posting a Gen Journal Line, values flow into different Ledger Entries depending upon the Account Type.  

In the case of sales invoices, when we define a new custom field in the sales header, we also define a new custom field with the same name. same data type and same id in the sales invoice header. And after posting a sales invoice that custom field automatically flows to the posted sales invoice. 

In BC 2021 Release Wave 2, I'm trying to post a General Journal but that new custom field is not flowing into respective ledger entries. For example, In Gen Journal Line the  "Account Type" is 'G/L Account' and "Bal Account Type" is also 'G/L Account' and after posting a General Journal, that new custom field doesn't automatically flow to General Ledger Entries. And similarly, that new custom field is not flowing to other ledger entries like customer ledger entries, vendor ledger entries, bank ledger entries, etc. 

This functionality is working fine in NAV 2017. but not working in BC 190. Can anyone please tell me how to resolve this issue,

Answers will be highly appreciated.

Thanks for reading.

  • M Hussnain Javed Profile Picture
    241 on at
    RE: Transferring custom fields form Gen. Journal Line to General Ledger Entries, Custom Ledger Entries and Vendor Ledger Entries

    Thanks for replying.

    I got this idea before but I was not aware of where are the required integration events defined by Microsoft. With further R&D, I found those integration events written on the table level. And I would like to show the code to help others in the future.

    [EventSubscriber(ObjectType::Table, Database::"G/L Entry", 'OnAfterCopyGLEntryFromGenJnlLine', '', false, false)]

       local procedure OnAfterCopyGLEntryFromGenJnlLine(var GenJournalLine: Record "Gen. Journal Line"; var GLEntry: Record "G/L Entry")

       begin

           GLEntry.Validate(Narration, GenJournalLine.Narration);

       end;

       [EventSubscriber(ObjectType::Table, Database::"Vendor Ledger Entry", 'OnAfterCopyVendLedgerEntryFromGenJnlLine', '', false, false)]

       local procedure OnAfterCopyVendLedgerEntryFromGenJnlLine(GenJournalLine: Record "Gen. Journal Line"; var VendorLedgerEntry: Record "Vendor Ledger Entry")

       begin

           VendorLedgerEntry.Validate(Narration, GenJournalLine.Narration);

       end;

       [EventSubscriber(ObjectType::Table, Database::"Cust. Ledger Entry", 'OnAfterCopyCustLedgerEntryFromGenJnlLine', '', false, false)]

       local procedure OnAfterCopyCustLedgerEntryFromGenJnlLine(var CustLedgerEntry: Record "Cust. Ledger Entry"; GenJournalLine: Record "Gen. Journal Line")

       begin

           CustLedgerEntry.Validate(Narration, GenJournalLine.Narration);

       end;

       [EventSubscriber(ObjectType::Table, Database::"Bank Account Ledger Entry", 'OnAfterCopyFromGenJnlLine', '', false, false)]

       local procedure OnAfterCopyFromGenJnlLine(var BankAccountLedgerEntry: Record "Bank Account Ledger Entry"; GenJournalLine: Record "Gen. Journal Line")

       begin

           BankAccountLedgerEntry.Validate(Narration, GenJournalLine.Narration);

       end;

  • Verified answer
    YUN ZHU Profile Picture
    81,789 Super User 2025 Season 1 on at
    RE: Transferring custom fields form Gen. Journal Line to General Ledger Entries, Custom Ledger Entries and Vendor Ledger Entries

    Hi, Some fields are not transferred automatically, so as Mohana mentioned, you need to investigate the event. Then you need to add Code as Subscription in Codeunit.

    More details: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-subscribing-to-events

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,021 Moderator on at
    RE: Transferring custom fields form Gen. Journal Line to General Ledger Entries, Custom Ledger Entries and Vendor Ledger Entries

    Maybe you can also look into using an additional dimension instead of a custom field, then you will not have to do any customization to get the extra info to the ledgers.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,222 Super User 2025 Season 1 on at
    RE: Transferring custom fields form Gen. Journal Line to General Ledger Entries, Custom Ledger Entries and Vendor Ledger Entries

    You have to use OnAfterInitGLEntry event of Codeunit "Gen. Jnl.-Post Line" to flow the fields

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans