web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

Insert Journal Template Name

(0) ShareShare
ReportReport
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;
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,307 Super User 2025 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans