Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Flow data from Purchase line to G/l Entry etc

Posted on by
Hello Everyone,
 
I have created one field which is posting description on purchase line then the same description of item will come in posting description and then posting description data will flow in G/l Entry, Item Ledger Entry, Posted Purchase Receipt line, Posted purchase Invoice these entity. which Events should i subscribe and then how the data will flow in business central.
 
Please suggest
Thank you
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 68,480 Super User 2024 Season 2 on at
    Flow data from Purchase line to G/l Entry etc
    Hi, I happen to have an example of Purchase Header to Item Ledger Entry here, I hope it can give you some tips.
    codeunit 50112 MyCodeunit
    {
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnPostItemJnlLineOnAfterDocumentFields, '', false, false)]
        local procedure OnPostItemJnlLineOnAfterCopyDocumentFields(var ItemJournalLine: Record "Item Journal Line"; PurchaseLine: Record "Purchase Line"; WarehouseReceiptHeader: Record "Warehouse Receipt Header"; WarehouseShipmentHeader: Record "Warehouse Shipment Header"; PurchRcptHeader: Record "Purch. Rcpt. Header");
        begin
            ItemJournalLine."Purch Document No." := PurchaseLine."Document No.";
        end;
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Line", OnAfterInitItemLedgEntry, '', false, false)]
        local procedure OnAfterInitItemLedgEntry(var NewItemLedgEntry: Record "Item Ledger Entry"; var ItemJournalLine: Record "Item Journal Line"; var ItemLedgEntryNo: Integer);
        begin
            NewItemLedgEntry."Purch Document No." := ItemJournalLine."Purch Document No.";
        end;
    }
    tableextension 50112 MyExtension extends "Item Journal Line"
    {
        fields
        {
            field(50000; "Purch Document No."; Code[20])
            {
                Caption = 'Purch Document No.';
                DataClassification = CustomerContent;
            }
        }
    }
    tableextension 50113 MyExtension2 extends "Item Ledger Entry"
    {
        fields
        {
            field(50000; "Purch Document No."; Code[20])
            {
                Caption = 'Purch Document No.';
                DataClassification = CustomerContent;
            }
        }
    }
    pageextension 50113 MyExtension extends "Item Ledger Entries"
    {
        layout
        {
            addafter("Document No.")
            {
                field("Purch Document No."; Rec."Purch Document No.")
                {
                    ApplicationArea = All;
                }
            }
        }
    }
     
    Thanks.
    ZHU

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

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…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,263 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans