NAV Design Pattern – Journal Template-Batch-Line

This week, the pattern is familiar to most C/AL developers, but if you are new to Microsoft Dynamics NAV, or if you need a refresher, here is the pattern behind journal templates, batches, and lines.

Meet the Pattern

The role of a journal line is to temporarily hold transaction data until the transaction is posted. Before posting, the entries are in a draft state, which means that they are available for corrections and/or deletion. As soon as the entries are posted, they are converted to ledger entries.

Journal templates are used to specify the underlying journal structure and to provide the default information for the journal batches. Journal batches usually serve to group journal lines, such as lines created by two different users.

Know the Pattern

Journal templates and journal batches are used if there is a need to create and post one or more entries. They are implemented in multiple areas of the application, like Sales, Purchases, Cash Receipts, Payments, Fixed Assets1.

Journal Templates

The journal templates are located on the Journal Template page. A Journal Template definition contains a series of attributes, such as:

  • Name
  • Description
  • Type
  • Recurring
  • No. Series

The Journal Template table stores the relevant attributes that define the nature and behavior of the journal templates, for example:

Journal Template Table Field

Description

Test Report ID

The journals offer the possibility of running test reports3. The role of a test report is to simulate the posting process. The verification criteria for the journal lines is ran, and the report can be displayed, all without doing the actual posting. This helps finding and correcting any errors that might exist in the data.

The name of the test report is the same with the name of the corresponding journal, plus the suffix ” – Test”. For example, the General Journal has the associated test report named General Journal – Test.

Posting Report ID

This report is printed when a user selects Post and Print4.

Page ID

For some journals, more UI objects are required. For example, the General Journals have a special page for bank and cash.

Source Code

Here you can enter a Trail Code for all the postings done through this Journal4.

Recurring

Whenever you post lines from a recurring journal, new lines are automatically created with a posting date defined in the recurring date formula.

Each journal template defines a default value of those attributes. The values that are defined in a template will be inherited by the journal batches, which will be created from a journal template.

 

Microsoft Dynamics NAV is released with a number of standard journal templates predefined in the Journal Templates page. More templates can be defined by the users.

Journal Batches

Journal batches are created with the help of the journal templates.

A journal batch is typically used to make a distinction between collections of logically grouped journal lines. A typical design is to have a journal batch for each user who enters lines. The batches are used during the posting process, in order to post one or multiple lines at once.

Journal Lines

Journal lines contain the actual business data (posting dates, account numbers, amounts) that will be posted as ledger entries.

During posting, only the information from the journal lines is needed. However, the information has been created with the help of the journal templates and grouped together using the journal batches.

Posting creates ledger entries from the temporary content that is stored in the journal lines. Ledger entries are not created directly. Instead, they are posted from journal lines.

 

Aggregation

There is a 1:n aggregation relationship between journal templates and journal batches, as well as between journal batches and journal lines. Deleting a template will cascade deletion of the related batches and lines. Deleting a batch will cascade into deletion of related lines.

Read more on NAV Patterns Wiki…

Best regards,

Bogdana Botez at Microsoft Development Center Copenhagen