Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

from which event we can insert the vendor ledger entries

(0) ShareShare
ReportReport
Posted on by 50

Hi All,

I am posting the general journal line with two lines one with account type customer and bankaccount for the customer line i am giving the apply entries and posting it from gen journal line, in the vendor ledger entries there is a custom field of type enum it has to populate in the vendor leger entries, but it is not populating as i think can anyone help me, i am attaching my code for your reference.

pastedimage1680609129653v1.png

Thanks & Regards

Satish

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,848 Super User 2024 Season 2 on at
    RE: from which event we can insert the vendor ledger entries

    Hi, I understand, I think the simpler way is to first add this field in the general journal line, when you set to apply entries, fill in the value, and then use the event I shared to solve the problem. This field may not be displayed on the General Journal.

    Hope this can give you some hints.

    Thanks.

    ZHU

  • Sarath9999 Profile Picture
    Sarath9999 50 on at
    RE: from which event we can insert the vendor ledger entries

    Hi Yun ZHU,

                    Thanks, for telling me that method, but  I can't use that event because in the general journal line there is no custom field of that one, in the customer ledger entries and vendor ledger entries only the custom field is there, we are selecting from the customer ledger entries and vendor ledger entries while populating it as if the bal account type is bank account and g/l account then in the customer ledger entries and vendor ledger entries it has to populate, for now if the customer have set to apply entries, then in the customer ledger entries and vendor ledger entries it has to populate the custom field.

    Thanks & Regards,

    Satish.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,848 Super User 2024 Season 2 on at
    RE: from which event we can insert the vendor ledger entries

    Hi, please try to use OnAfterCopyVendLedgerEntryFromGenJnlLine event.

    For example,

    pastedimage1680652383616v1.png

    pastedimage1680652392657v2.png

    pastedimage1680652398673v3.png

    pastedimage1680652418844v4.png

    Test code:

    tableextension 50111 MyExtension extends "Gen. Journal Line"
    {
        fields
        {
            field(50100; ZYTest; Text[50])
            {
                DataClassification = CustomerContent;
            }
        }
    }
    
    tableextension 50112 MyExtension2 extends "Vendor Ledger Entry"
    {
        fields
        {
            field(50100; ZYTest; Text[50])
            {
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50111 MyExtension extends "General Journal"
    {
        layout
        {
            addafter("Account No.")
            {
                field(ZYTest; Rec.ZYTest)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    pageextension 50112 MyExtension2 extends "Vendor Ledger Entries"
    {
        layout
        {
            addafter("Vendor Name")
            {
                field(ZYTest; Rec.ZYTest)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    codeunit 50111 MyCodeunit
    {
        [EventSubscriber(ObjectType::Table, Database::"Vendor Ledger Entry", OnAfterCopyVendLedgerEntryFromGenJnlLine, '', false, false)]
        local procedure OnAfterCopyVendLedgerEntryFromGenJnlLine(var VendorLedgerEntry: Record "Vendor Ledger Entry"; GenJournalLine: Record "Gen. Journal Line");
        begin
            VendorLedgerEntry.ZYTest := GenJournalLine.ZYTest;
        end;
    }

    Hope this helps.

    Thanks.

    ZHU

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans