Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Insert Journal Template Name

Posted on by
hi Expert,
 
i create an action to post an Expense (spesific page) and for that i create a function PostExpense() the function is work but what i want is to get the /Journal Template Name/ automaticly  are any body of you knew  how to do that, any suggestion
 
    local procedure PostExpense()
    var
        NoMgmt: Codeunit NoSeriesManagement;
        GLSetup: Record /General Ledger Setup/;
 
    begin
 
        GenJnlLine.Init();
        GenJnlLine./Journal Template Name/ := 'GÉNÉRAL';
        GenJnlBatch.SetRange(/Journal Template Name/, GenJnlLine./Journal Template Name/);
        if GenJnlBatch.FindFirst() then
            GenJnlLine./Journal Batch Name/ := GenJnlBatch.Name;
        GenJnlLine./Line No./ := GenJnlLine.GetNewLineNo(GenJnlLine./Journal Template Name/, GenJnlLine./Journal Batch Name/);
 
        GenJnlLine./Posting Date/ := ExpenseHeader./Posting Date/;
        GenJnlLine./Document Date/ := ExpenseHeader./Document Date/;
        GenJnlLine./Document Type/ := GenJnlLine./document type/::/ /;
        GenJnlLine./Document No./ := ExpenseHeader./No./;
        GenJnlLine./Account Type/ := GenJnlLine./account type/::Employee;
        GenJnlLine.Validate(/Account No./, ExpenseHeader./Ressource No./);
        ExpenseHeader.CalcFields(Amount);
        GenJnlLine.Validate(/Credit Amount/, ExpenseHeader.Amount);
        GenJnlLine./System-Created Entry/ := false;
        GenJnlLine.Correction := false;
        GenJnlLine./Source Code/ := SrcCode;
        GenJnlLine./Shortcut Dimension 1 Code/ := ExpenseHeader./Shortcut Dimension 1 Code/;
        GenJnlLine./Shortcut Dimension 2 Code/ := ExpenseHeader./Shortcut Dimension 2 Code/;
        GenJnlPostLine.RunWithCheck(GenJnlLine);
        GenJnlLine.Insert();
 
    end;
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,698 Super User 2024 Season 2 on at
    Insert Journal Template Name
    Hi, You can try to use Source Code Setup

     
    Hope this helps.
    Thanks.
    ZHU

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

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans