Skip to main content

Notifications

Announcements

No record found.

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

General Journal Line

(0) ShareShare
ReportReport
Posted on by 130

when we add Fields in General Jounral line , once posted, the data in the field should have to take the value in the table Fixed Asset Ledgers, if you know can anybody help me. I am attaching my codeunit what I have done on this. I  used the event in the codeunit Gen.Jnl.post  but I  didn't get the value


    // [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnPostFixedAssetOnBeforeAssignGLEntry', '', false, false)]
    // local procedure OnPostFixedAssetOnBeforeAssignGLEntry(var GenJournalLine: Record "Gen. Journal Line"; var GLEntry: Record "G/L Entry"; var IsHandled: Boolean; var TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary; GLEntry2: Record "G/L Entry"; NextEntyNo: Integer;FALedgerEntry: Record "FA Ledger Entry")
    // begin
    //   FALedgerEntry."Product Name"   := GenJournalLine."Product Name";
    // end;
  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,056 on at
    RE: General Journal Line

    Hi,

    You can use below logic to write the add your values from general journal line to FA ledger entries

    codeunit 50125 PostFAProductNameCodeunit
    {
       
        Permissions = tabledata "FA Ledger Entry" = rimd;


        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterPostGenJnlLine', '', false, false)]
        local procedure OnAfterPostGenJnlLine(var GenJournalLine: Record "Gen. Journal Line")
        var
            Rec_FaLedgerEntries: Record "FA Ledger Entry";
        begin
            Clear(Rec_FaLedgerEntries);
            Rec_FaLedgerEntries.Reset();
            if (GenJournalLine."Product Name" <> '') or (GenJournalLine."Account Type" = GenJournalLine."Account Type"::"Fixed Asset") then begin
                Rec_FaLedgerEntries.SetRange("Document No.", GenJournalLine."Document No.");
                Rec_FaLedgerEntries.SetRange("FA No.", GenJournalLine."Account No.");
                Rec_FaLedgerEntries.SetRange("Posting Date", GenJournalLine."Posting Date");
                if Rec_FaLedgerEntries.FindFirst() then begin
                    Rec_FaLedgerEntries."Product Name" := GenJournalLine."Product Name";
                    Rec_FaLedgerEntries.Modify(true);
                end;
            end;

        end;

    }

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much

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,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans