---
id: object/codeunit/230
type: object
title: Codeunit 230 "GenJnlManagement"
summary: Codeunit 230 "GenJnlManagement" in Base Application (Microsoft.Finance.GeneralLedger.Journal). 21 public procedures, 19 events. Present since at least BC23, still in BC30, changed in BC29.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "29"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 50a4c84bcf9aa3e3151b7d978cb7313e276df3c3353492049accd54ec824afaa
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlManagement.Codeunit.al
    title: src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlManagement.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/nl
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/10538
    - change/bcapps/8959
object_type: codeunit
object_id: 230
name: GenJnlManagement
namespace: Microsoft.Finance.GeneralLedger.Journal
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "29"
source_major: "29"
obsolete: null
countries:
  - nl
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 45
  events: 19
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 1
  calls: 0
  called_by: 24
  implements: 0
---

# Codeunit 230 "GenJnlManagement"

> Codeunit 230 "GenJnlManagement" in Base Application (Microsoft.Finance.GeneralLedger.Journal). 21 public procedures, 19 events. Present since at least BC23, still in BC30, changed in BC29.

Base Application · Microsoft.Finance.GeneralLedger.Journal · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlManagement.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "Gen. Journal Template" = rimd, TableData "Gen. Journal Batch" = rimd |

## Events published

- `OnAfterGetAccounts(var GenJournalLine: Record "Gen. Journal Line"; var AccName: Text[100]; var BalAccName: Text[100])` (integration): Integration event raised after retrieving account names for journal line display. Enables customization of account name lookup and display logic.
- `OnAfterCheckName(GenJnlBatch: Record "Gen. Journal Batch"; CurrentJnlBatchName: Code[10]; var GenJournalLine: Record "Gen. Journal Line")` (integration): Integration event raised after validating journal batch name exists and is properly configured. Enables custom batch validation logic and post-validation processing.
- `OnAfterSetName(var GenJournalLine: Record "Gen. Journal Line"; CurrentJnlBatchName: Code[10])` (integration): Integration event raised after setting journal batch filter on journal lines. Enables custom filtering logic and post-filter processing.
- `OnAfterOpenJournalBatch(GenJnlBatch: Record "Gen. Journal Batch"; GenJnlTemplate: Record "Gen. Journal Template")` (integration): Integration event raised after opening journal batch operations complete. Enables custom logic after batch and template have been selected and configured.
- `OnAfterTemplateSelection(var GenJnlTemplate: Record "Gen. Journal Template"; var GenJnlLine: Record "Gen. Journal Line"; var JnlSelected: Boolean; var OpenFromBatch: Boolean; RecurringJnl: Boolean)` (integration): Integration event raised after template selection process completes. Enables custom logic after template selection and journal page launch.
- `OnBeforeLookupName(var GenJnlBatch: Record "Gen. Journal Batch"; var GenJnlLine: Record "Gen. Journal Line")` (integration): Integration event raised before journal batch name lookup operations. Enables custom filtering or validation logic before batch selection.
- `OnBeforeGetJournalSimplePageModePreference(PageIdToCheck: Integer)` (integration): Integration event raised before retrieving journal simple page mode preference. Enables custom logic before preference retrieval.
- `OnBeforeSetJournalSimplePageModePreference(var SetToSimpleMode: Boolean; PageIdToSet: Integer; var IsHandled: Boolean)` (integration): Integration event raised before setting journal simple page mode preference. Enables custom validation or modification of preference settings.
- `OnBeforeOpenJnl(var CurrentJnlBatchName: Code[10]; var GenJnlLine: Record "Gen. Journal Line")` (integration): Integration event raised before opening journal with batch name operations. Enables custom validation or preprocessing before journal opening.
- `OnBeforeOpenJnlBatch(var GenJnlBatch: Record "Gen. Journal Batch"; var IsHandled: Boolean)` (integration): Integration event raised before journal batch opening operations. Enables custom logic to completely override batch opening process.
- `OnBeforeOpenJournalPageFromBatch(var GenJnlBatch: Record "Gen. Journal Batch"; var GenJnlTemplate: Record "Gen. Journal Template"; var IsHandled: Boolean)` (integration): Integration event raised before opening journal page from batch context. Enables custom logic to override page opening from batch selection.
  - subscribers: [Codeunit 1695 "Bank Deposit Subscribers"](../codeunit/1695.md) OnBeforeOpenJournalPageFromBatch
- `OnBeforeRunTemplateJournalPage(var GenJnlTemplate: Record "Gen. Journal Template"; var GenJnlLine: Record "Gen. Journal Line"; OpenFromBatch: Boolean; var IsHandled: Boolean)` (integration): Integration event raised before running template journal page operations. Enables custom logic to override journal page launching.
- `OnTemplateSelectionSetFilter(var GenJnlTemplate: Record "Gen. Journal Template"; var PageTemplate: Option; var RecurringJnl: Boolean; PageId: Integer; var GenJnlLine: Record "Gen. Journal Line")` (integration): Integration event raised during template selection to enable custom filtering logic. Allows modification of template filters and selection criteria.
- `OnFindTemplateFromSelectionOnBeforeGenJnlTemplateInsert(var GenJnlTemplate: Record "Gen. Journal Template")` (integration): Integration event raised before inserting a new journal template during template selection. Enables custom template configuration before insertion.
- `OnOpenJnlOnAfterCheckTemplateName(var GenJournalLine: Record "Gen. Journal Line"; var CurrentJnlBatchName: Code[10])` (integration): Integration event raised after template name checking during journal opening. Enables custom processing after template validation.
- `OnOpenJnlBatchOnBeforeCheckGenJnlTemplateCount(var GenJnlBatch: Record "Gen. Journal Batch"; var GenJnlTemplate: Record "Gen. Journal Template")` (integration): Integration event raised before checking journal template count during batch operations. Enables custom template filtering or validation logic.
- `OnAfterCalcBalance(var GenJournalLine: Record "Gen. Journal Line")` (integration): Integration event raised after balance calculation operations complete. Enables custom processing or validation after balance calculations.
- `OnCalcBalanceOnAfterCopyFilters(var TempGenJournalLine: Record "Gen. Journal Line" temporary)` (integration): Integration event raised after copying filters during balance calculation setup. Enables custom filter modification before balance calculation processing.
- `OnCalcBalanceOnBeforeTempGenJnlLineNext(var TempGenJournalLine: Record "Gen. Journal Line")` (integration): Integration event raised before moving to next record during balance calculation. Enables custom record positioning logic during balance calculation.

## Procedures

- `TemplateSelection(PageID: Integer; PageTemplate: Enum "Gen. Journal Template Type"; RecurringJnl: Boolean; var GenJnlLine: Record "Gen. Journal Line"; var JnlSelected: Boolean)`: Manages template selection for journal pages based on page type and recurring journal requirements. Filters available templates and launches appropriate journal interface.
- `TemplateSelectionFromBatch(var GenJnlBatch: Record "Gen. Journal Batch")`: Opens journal interface directly from a batch selection, bypassing template selection. Validates batch configuration and launches the appropriate journal page.
- `OpenJnl(var CurrentJnlBatchName: Code[10]; var GenJnlLine: Record "Gen. Journal Line")`: Opens journal batch with current batch name and manages batch selection logic. Handles batch validation and provides default batch creation when necessary.
- `OpenJnlBatch(var GenJnlBatch: Record "Gen. Journal Batch")`: Opens and initializes a general journal batch with template selection and validation. Ensures proper batch setup by creating missing templates and handling batch selection logic.
- `IsBatchNoSeriesEmpty(var CurrentJnlBatchName: Code[10]; var GenJnlLine: Record "Gen. Journal Line"): Boolean`: Checks if the journal batch has an empty number series configuration. Validates whether the batch requires manual document numbering or has automatic numbering configured.
- `CheckTemplateName(CurrentJnlTemplateName: Code[10]; var CurrentJnlBatchName: Code[10])`
- `CheckName(CurrentJnlBatchName: Code[10]; var GenJnlLine: Record "Gen. Journal Line")`: Validates journal batch exists and gets batch configuration for the specified batch name. Ensures batch is properly configured before allowing journal operations.
- `CheckCurrencyCode(CurrencyCode: Code[10])`: Validates currency code exists in the currency master data. Provides currency validation for journal line processing.
- `SetName(CurrentJnlBatchName: Code[10]; var GenJnlLine: Record "Gen. Journal Line")`: Sets journal batch filter on journal lines and positions to first record. Configures journal line record for batch-specific operations.
- `SetJournalSimplePageModePreference(SetToSimpleMode: Boolean; PageIdToSet: Integer)`: Configures journal page display mode preference for the current user. Stores user preference for simple or classic view mode in journal pages.
- `GetJournalSimplePageModePreference(PageIdToCheck: Integer): Boolean`: Retrieves journal page display mode preference for the current user. Returns user preference for simple or classic view mode in journal pages.
- `GetLastViewedJournalBatchName(PageIdToCheck: Integer): Code[10]`: Retrieves the last viewed journal batch name for a specific page from user preferences. Returns stored user preference for batch selection when reopening journal pages.
- `SetLastViewedJournalBatchName(PageIdToCheck: Integer; GenJnlBatch: Code[10])`: Stores the last viewed journal batch name for a specific page in user preferences. Updates user preference for batch selection to improve user experience on page reopening.
- `LookupName(var CurrentJnlBatchName: Code[10]; var GenJnlLine: Record "Gen. Journal Line")`: Provides journal batch lookup functionality with filtering and selection capabilities. Opens batch selection page and updates current batch name based on user selection.
- `SetJnlBatchName(var GenJnlLine: Record "Gen. Journal Line")`: Opens journal batch name lookup and updates journal line batch assignment. Provides user interface for selecting and assigning journal batch to current line.
- `GetAccounts(var GenJnlLine: Record "Gen. Journal Line"; var AccName: Text[100]; var BalAccName: Text[100])`: Retrieves and caches account names for display in journal lines to improve user experience. Optimizes performance by caching account names to avoid repeated database lookups.
- `CalcBalance(var GenJnlLine: Record "Gen. Journal Line"; LastGenJnlLine: Record "Gen. Journal Line"; var Balance: Decimal; var TotalBalance: Decimal; var ShowBalance: Boolean; var ShowTotalBalance: Boolean)`: Calculates running balance and total balance for journal lines within the current batch context. Provides balance calculations for journal line display and validation purposes.
- `CalcBatchTotal(var GenJnlLine: Record "Gen. Journal Line"; var BatchTotal: Decimal; var ShowBatchTotal: Boolean)`
- `GetAvailableGeneralJournalTemplateName(TemplateName: Code[10]): Code[10]`: Generates unique journal template names by checking for conflicts and incrementing names when needed. Ensures new template names are unique while maintaining meaningful naming based on template type.
- `TemplateSelectionSimple(var GenJnlTemplate: Record "Gen. Journal Template"; TemplateType: Enum "Gen. Journal Template Type"; RecurringJnl: Boolean): Boolean`
- `ShowNotificationIfSpendRequestIsRequired(GLAccountNo: Code[20]; SpendRequestNo: Code[20]; var NotificationID: Guid)` (internal): Used from journal pages and warns users of need to specify spend request no.

Plus 5 local procedures.

## Triggers

OnRun

## Called by

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Page 39 "General Journal"](../page/39.md) (11 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnAfterGetRecord → GetAccounts`, …)
- [Page 254 "Purchase Journal"](../page/254.md) (9 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnAfterGetRecord → GetAccounts`, …)
- [Page 253 "Sales Journal"](../page/253.md) (8 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnAfterGetRecord → GetAccounts`, …)
- [Page 256 "Payment Journal"](../page/256.md) (7 calls: `CurrentJnlBatchNameOnAfterValidate → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnAfterGetRecord → GetAccounts`, …)
- [Page 255 "Cash Receipt Journal"](../page/255.md) (6 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnAfterGetRecord → GetAccounts`, …)
- [Page 1020 "Job G/L Journal"](../page/1020.md) (5 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnOpenPage → OpenJnl`, …)
- [Page 283 "Recurring General Journal"](../page/283.md) (5 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnOpenPage → OpenJnl`, …)
- [Page 5628 "Fixed Asset G/L Journal"](../page/5628.md) (5 calls: `CurrentJnlBatchNameOnAfterValidate → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnOpenPage → OpenJnl`, …)
- [Page 610 "IC General Journal"](../page/610.md) (5 calls: `CurrentJnlBatchNameOnAfterVali → SetName`, `OnAfterGetCurrRecord → GetAccounts`, `OnOpenPage → OpenJnl`, …)
- [Page 1190 "Create Payment"](../page/1190.md) (2 calls: `BatchSelection → CheckTemplateName`, `OnOpenPage → TemplateSelectionSimple`)
- [Page 1690 "Bank Deposit"](../page/1690.md) (2 calls: `OnOpenPage → OpenJnl`, `OnOpenPage → TemplateSelection`)
- [Table 1690 "Bank Deposit Header"](../table/1690.md) (2 calls: `InitRecord → LookupName`, `InitRecord → SetName`)
- [Codeunit 181 "Copy Gen. Journal Mgt."](../codeunit/181.md) (1 call: `ShowFinishMessage → TemplateSelectionFromBatch`)
- [Codeunit 233 "Gen. Jnl.-B.Post"](../codeunit/233.md) (1 call: `Code → GetJournalSimplePageModePreference`)
- [Codeunit 234 "Gen. Jnl.-B.Post+Print"](../codeunit/234.md) (1 call: `Code → GetJournalSimplePageModePreference`)
- [Codeunit 5469 "Library API - General Journal"](../codeunit/5469.md) (1 call: `SetUpNewLine → CalcBalance`)
- [Page 251 "General Journal Batches"](../page/251.md) (1 call: `OnOpenPage → OpenJnlBatch`)
- [Page 9120 "Journal Line Details FactBox"](../page/9120.md) (1 call: `OnAfterGetCurrRecord → GetAccounts`)
- [Report 1497 "Trans. Bank Rec. to Gen. Jnl."](../report/1497.md) (1 call: `OnPostReport → TemplateSelectionFromBatch`)
- [Report 597 "G/L Currency Revaluation"](../report/597.md) (1 call: `OpenGeneralJournalBatch → TemplateSelectionFromBatch`)
- [Report 8610 "Create G/L Acc. Journal Lines"](../report/8610.md) (1 call: `CopyGenJnlFromStdJnl → CalcBalance`)
- [Report 8611 "Create Customer Journal Lines"](../report/8611.md) (1 call: `CopyGenJnlFromStdJnl → CalcBalance`)
- [Report 8612 "Create Vendor Journal Lines"](../report/8612.md) (1 call: `CopyGenJnlFromStdJnl → CalcBalance`)
- [Table 750 "Standard General Journal"](../table/750.md) (1 call: `CopyGenJnlFromStdJnl → CalcBalance`)

## Recent changes

- 2026-09-02 [#10538 [Master]-Slice 425446: Payment Journal Batch Total](../../changes/bcapps/10538.md) (main, BC30, feature)
- 2026-07-31 [#8959 Deliverable 638799: Spend Requests in Base App](../../changes/bcapps/8959.md) (main, BC30, feature)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC29

## Countries that replace it

[NL](../../localizations/nl.md)

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "GenJnlManagement")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
