Skip to main content

Notifications

Community site session details

Community site session details

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

Custom Field addition to Item Journal Line Table

(1) ShareShare
ReportReport
Posted on by 72
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
    84,682 Super User 2025 Season 1 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
  • Gerardo Rentería García Profile Picture
    19,937 Most Valuable Professional on at
    Custom Field addition to Item Journal Line Table
    Hi
    Best
    GR
  • Suggested answer
    Valentin Castravet Profile Picture
    28,279 Super User 2025 Season 1 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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans