Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

flow data purchase header to value entry

Posted on by 125

Hi ,

 how to flow the data from purchase header to value entry using vs code in Business Central?

  • Verified answer
    Arepaka Sai Profile Picture
    Arepaka Sai 125 on at
    RE: flow data purchase header to value 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 value entry

    Hi, please try the following.

    pastedimage1651457546570v1.png

    pastedimage1651457564642v2.png

    pastedimage1651457581213v3.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 50134 ItemJournalLineExt extends "Item Journal Line"
    {
        fields
        {
            field(50100; ZYTest; Text[100])
            {
                Caption = 'ZY Test';
                DataClassification = CustomerContent;
            }
        }
    }
    
    tableextension 50135 ValueEntry extends "Value Entry"
    {
        fields
        {
            field(50100; ZYTest; Text[100])
            {
                Caption = 'ZY Test';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50135 ValueEntries extends "Value Entries"
    {
        layout
        {
            addafter("Document No.")
            {
                field(ZYTest; Rec.ZYTest)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    codeunit 50134 FlowDatatoValueEntry
    {
    
        [EventSubscriber(ObjectType::Table, Database::"Item Journal Line", 'OnAfterCopyItemJnlLineFromPurchHeader', '', false, false)]
        local procedure OnAfterCopyItemJnlLineFromPurchHeader(var ItemJnlLine: Record "Item Journal Line"; PurchHeader: Record "Purchase Header");
        begin
            ItemJnlLine.ZYTest := PurchHeader.ZYTest;
        end;
    
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Line", 'OnBeforeInsertValueEntry', '', false, false)]
        local procedure OnBeforeInsertValueEntry(var ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ItemLedgerEntry: Record "Item Ledger Entry"; var ValueEntryNo: Integer; var InventoryPostingToGL: Codeunit "Inventory Posting To G/L"; CalledFromAdjustment: Boolean; var OldItemLedgEntry: Record "Item Ledger Entry"; var Item: Record Item; TransferItem: Boolean; var GlobalValueEntry: Record "Value Entry");
        begin
            ValueEntry.ZYTest := ItemJournalLine.ZYTest;
        end;
    
    
    }

    Thanks.

    ZHU

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

    thank you

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: flow data purchase header to value entry

    Hi Arepaka Sai ,

    Not sure what is the requirement but you can use Codeunit 22, check what are the events available to transfer data from Purchase Line to Value entry when you do post any receipt. In the same way you can try to use those events and send data from Purchase header to Value entry.

    Thanks.

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