Skip to main content

Notifications

Announcements

No record found.

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 68
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 78,198 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
  • gdrenteria Profile Picture
    gdrenteria 14,758 Most Valuable Professional on at
    Custom Field addition to Item Journal Line Table
    Hi
    Best
    GR
  • Suggested answer
    Valentin Castravet Profile Picture
    Valentin Castravet 26,363 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,575 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans