web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Add newly created field in Posting code

(1) ShareShare
ReportReport
Posted on by 72
Hi
 
I have created  fields in Purchase line table with name 'Desc 2' to store more text. When I post the same, I wanted to update this field in GL  Entry , VLE, etc. I request  a sample code for my extension or methods to extend codeunit Post-Purchase line/Post Item jnl
 
warm regards
Krishna
 
I have the same question (0)
  • Suggested answer
    Gerardo Rentería García Profile Picture
    25,547 Most Valuable Professional on at
    Hi
    I hope this can help you and give you some hints. 
    Best regards
    Gerardo
  • Suggested answer
    YUN ZHU Profile Picture
    98,620 Super User 2026 Season 1 on at
    Hi, as far as I know, this is a standard field and doesn't need to be recreated. It is recommended that you use it directly.
     
     
    Thanks.
    ZHU
  • Suggested answer
    Shathika Karunaratne Profile Picture
    6 on at
    Hi,
     
    You can use the below event subscribers.
    Purchase Line to Item Journal Lines
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnPostItemJnlLineOnAfterCopyDocumentFields, '', 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."ZY Test" := PurchaseLine."ZY Test";
    end;
     
    Item Journal Lines to Item Ledger Entry
    [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."ZY Test" := ItemJournalLine."ZY Test";
    end;
  • KK-20050817-0 Profile Picture
    72 on at
    I have code in my codeunit, my requirements are like G/L account  in Purchase line. In the case of item we can use the following code.
     
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnPostItemJnlLineOnAfterCopyDocumentFields, '', 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.Description2 := PurchaseLine."Description 2";
        end;
     
    My company do not use item in Purchase, we use only G/L account. 
     
    warm regards
    krishna
     
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,822 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,136 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 956 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans