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.

Categories:
  • 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
    62,477 Moderator 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
    32,718 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
    45,317 Moderator 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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

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... 283,860 Test role Public

#2
Ludwig Reinhard Profile Picture

Ludwig Reinhard Microsoft Employee

#3
Martin Dráb Profile Picture

Martin Dráb 225,155 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans