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...
Answered

Adding a Custom field to Payment Journal that can post to Vendor Ledger Entry

(1) ShareShare
ReportReport
Posted on by 107
Good Day Experts,

I am trying to get the data of my new custom field /APTRRC_PayJourNo/ on table Gen. Journal Line to reflect on Vendor Ledger Entries when posted.

What I have done so far is:

* Created the new field /APTRRC_PayJourNo/ on Table /Gen. Journal Line/
* Created the new field /APTRRC_PayJourNo/ on Table /Vendor Ledger Entry/
* Created an EventSubscriber that should carry the data over to the Vendor Ledger Entry table.

Currently this is not working, please see below my EventSubscriber: (I am not sure if i am using the correct event or if this code will work there are 264 events triggered when the post button is clicked)
 
    [EventSubscriber(ObjectType::Codeunit, Codeunit::/Gen. Jnl.-Post Line/, 'OnAfterInitVendLedgEntry', '', false, false)]
    local procedure PayJourNo(VendorLedgerEntry: Record /Vendor Ledger Entry/; GenJournalLine: Record /Gen. Journal Line/)
    begin
        VendorLedgerEntry.APTRRC_PayJourNo := GenJournalLine.APTRRC_PayJourNo;
        Message('Event Triggered, %1, %2', GenJournalLine.APTRRC_PayJourNo, VendorLedgerEntry.APTRRC_PayJourNo);
    end;

In my message box I do get the correct values to show when I click the post button but when I navigate to Vendor Ledger Entries my value remains blank.

Can you please assist me where I am going wrong?

Thanks
 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    98,421 Super User 2026 Season 1 on at
    Hi, please try the following.
    tableextension 50112 MyExtension extends "Gen. Journal Line"
    {
        fields
        {
            field(50100; "My Field"; Text[30])
            {
                Caption = 'My Field';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50111 MyExtension extends "Payment Journal"
    {
        layout
        {
            addafter(Description)
            {
                field("My Field"; Rec."My Field")
                {
                    ApplicationArea = All;
                    Caption = 'My Field';
                }
            }
        }
    }
    
    tableextension 50113 MyExtension2 extends "Vendor Ledger Entry"
    {
        fields
        {
            field(50100; "My Field"; Text[30])
            {
                Caption = 'My Field';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50113 MyExtension2 extends "Vendor Ledger Entries"
    {
        layout
        {
            addafter(Description)
            {
                field("My Field"; Rec."My Field")
                {
                    ApplicationArea = All;
                    Caption = 'My Field';
                }
            }
        }
    }
    
    codeunit 50113 MyCodeunit2
    {
        [EventSubscriber(ObjectType::Table, Database::"Vendor Ledger Entry", 'OnAfterCopyVendLedgerEntryFromGenJnlLine', '', false, false)]
        local procedure OnAfterCopyVendLedgerEntryFromGenJnlLine(GenJournalLine: Record "Gen. Journal Line"; var VendorLedgerEntry: Record "Vendor Ledger Entry")
        begin
            VendorLedgerEntry.Validate("My Field", GenJournalLine."My Field");
        end;
    }
     
    Test:
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Shrey Chauhan Profile Picture
    284 on at
    Hello,

    You use this following code for your reference and queries:
     
    tableextension 50002 GenJournalLineTab extends "Gen. Journal Line"
    {
        fields
        {
            field(50001; "APTRRC PayJourNo."; Code[20])
            {
                Caption = 'APTRRC PayJourNo.';
                DataClassification = CustomerContent;
            }
        }
    }
    pageextension 50002 PaymentJournalCard extends "Payment Journal"
    {
        layout
        {
            addafter("Account No.")
            {
                field("APTRRC PayJourNo."; Rec."APTRRC PayJourNo.")
                {
                    ApplicationArea = All;
                    Caption = 'APTRRC PayJourNo.';
                }
            }
        }
    }
    tableextension 50003 VendorLedgerEntryTab extends "Vendor Ledger Entry"
    {
        fields
        {
            field(50001; "APTRRC PayJourNo."; Code[20])
            {
                Caption = 'APTRRC PayJourNo.';
                DataClassification = CustomerContent;
            }
        }
    }
    pageextension 50003 VendorLedgerEntry extends "Vendor Ledger Entries"
    {
        layout
        {
            addafter("Document No.")
            {
                field("APTRRC PayJourNo."; Rec."APTRRC PayJourNo.")
                {
                    ApplicationArea = All;
                    Caption = 'APTRRC PayJourNo.';
                }
            }
        }
    }
    codeunit 50003 EventSubCodeunit
    {
        [EventSubscriber(ObjectType::Table, Database::"Vendor Ledger Entry", 'OnAfterCopyVendLedgerEntryFromGenJnlLine', '', false, false)]
        local procedure OnAfterCopyVendLedgerEntryFromGenJnlLine(GenJournalLine: Record "Gen. Journal Line"; var VendorLedgerEntry: Record "Vendor Ledger Entry")
        begin
            VendorLedgerEntry.Validate("APTRRC PayJourNo.", GenJournalLine."APTRRC PayJourNo.");
        end;
    }

    Hope this helps,

    Thank you.
  • Divan Profile Picture
    107 on at
    Thanks guys

    Both these answers work 100%, looks like I have used the wrong EventSubscriber

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,857 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,047 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans