Skip to main content

Notifications

Announcements

No record found.

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

Custom Field addition to Item Journal Line Table

(1) ShareShare
ReportReport
Posted on by 60
UPDATE [2024-11-08]
It seems my code now works. So, the onbeforeInsertItemLedgerEntry event seems to work properly when flowing the field from the Item Journal Line to the Item ledger Entry table. I can also confirm that all three answers to this question are ways to allow the item to flow to the Item ledger entry. Thank you for the splendid responses. I learned so much more by just asking this question. 

Hi All,

I was wondering is any of you have experience already with the following scenario:
I have added a custom field to the Item journal Line table and the Item Ledger Entry table. 

I am now trying to get this field to be posted with the Item ledger Entry table when I use Post or Preview Posting.
I cannot seem to find the right subscription event. 
 
Basically, what I am trying to do is when I fill in my custom field and preview the post I would expect to see the field copied over to the Item Ledger Preview postings. But it just does nto do that. Any help would be greatly appreciated. 

Right now, I have tried the following event to get this done:
 
[EventSubscriber(ObjectType::Codeunit, CodeUnit::"Item Jnl.-Post Line", 'OnBeforeInsertItemLedgEntry', '', false, false)]
 
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 74,148 Super User 2024 Season 2 on at
    Custom Field addition to Item Journal Line Table
    Hi, try the following
    codeunit 50122 EventHandler
    {
        [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;
    }
    tableextension 50122 ItemJournalLineExt extends "Item Journal Line"
    {
        fields
        {
            field(50000; "ZY Test"; Text[100])
            {
                Caption = 'ZY Test';
                DataClassification = CustomerContent;
            }
        }
    }
    pageextension 50122 ItemJournalExt extends "Item Journal"
    {
        layout
        {
            addafter(Description)
            {
                field("ZY Test"; Rec."ZY Test")
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    tableextension 50113 ItemLedgerEntryExt extends "Item Ledger Entry"
    {
        fields
        {
            field(50000; "ZY Test"; Text[100])
            {
                Caption = 'ZY Test';
                DataClassification = CustomerContent;
            }
        }
    }
    pageextension 50113 ItemLedgerEntriesExt extends "Item Ledger Entries"
    {
        layout
        {
            addafter("Document No.")
            {
                field("ZY Test"; Rec."ZY Test")
                {
                    ApplicationArea = All;
                }
            }
        }
    }
     
    Thanks.
    ZHU
  • gdrenteria Profile Picture
    gdrenteria 12,546 Most Valuable Professional on at
    Custom Field addition to Item Journal Line Table
    Hi
    Best
    GR
  • Suggested answer
    Valentin Castravet Profile Picture
    Valentin Castravet 24,961 Super User 2024 Season 2 on at
    Custom Field addition to Item Journal Line Table

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans