Skip to main content

Notifications

Announcements

No record found.

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

flow data purchase header to Detailed vendor ledger entry

Posted on by 125

Hi,

How to flow the data from purchase header to detailed vendor ledger entry using VS code in business central?

  • Arepaka Sai Profile Picture
    Arepaka Sai 125 on at
    RE: flow data purchase header to Detailed vendor ledger entry

    Thank you

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,696 Super User 2024 Season 2 on at
    RE: flow data purchase header to Detailed vendor ledger entry

    Hi, just a idea, You can easily pass the value to the Vendor Ledger Entry as follows.

    pastedimage1651629134525v2.png

    tableextension 50133 PurchaseHeaderExt extends "Purchase Header"
    {
        fields
        {
            field(50100; ZYTest; Text[100])
            {
                Caption = 'ZY Test';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50133 PurchaseOrderExt extends "Purchase Order"
    {
        layout
        {
            addafter(Status)
            {
                field(ZYTest; Rec.ZYTest)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    tableextension 50135 "Vend Ledg. Entry Ext" extends "Vendor Ledger Entry"
    {
        fields
        {
            field(50100; ZYTest; Text[100])
            {
                Caption = 'ZY Test';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50135 "Vend Ledg Entries Ext" extends "Vendor Ledger Entries"
    {
        layout
        {
            addafter("Document No.")
            {
                field(ZYTest; Rec.ZYTest)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    codeunit 50134 FlowDatatoDtlVendorLedgEntry
    {
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", 'OnAfterPostInvoice', '', false, false)]
        local procedure OnAfterPostInvoice(var PurchHeader: Record "Purchase Header"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; TotalPurchLine: Record "Purchase Line"; TotalPurchLineLCY: Record "Purchase Line"; CommitIsSupressed: Boolean; var VendorLedgerEntry: Record "Vendor Ledger Entry");
        begin
            VendorLedgerEntry.ZYTest := PurchHeader.ZYTest;
            VendorLedgerEntry.Modify();
        end;
    }

    Then create a Flow field in detailed vendor ledger entry to get data from Vendor Ledger Entry.

    More details: https://yzhums.com/5802/

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: flow data purchase header to Detailed vendor ledger entry

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans