Skip to content

[W1]Codeunit [240] ItemJnlManagement- OnAfterTemplateSelection & OnAfterJournalTemplateSelection Event Requested #8235

@nandis03

Description

@nandis03

Why do you need this change?

Microsoft Idea Proposal Document-CU 240 ItemJnlManagement.docx

Enhancement Request: Add Event in ItemJnlManagement Procedure (TemplateSelection and OpenJnl)

Business case:
The requested enhancement is needed to enforce user-level control over access to Item and General Journal Templates, as standard Business Central does not provide the ability to restrict journal templates at a user level. To meet business control and audit requirements, the application must introduce a mechanism to limit template visibility and usage based on user-specific mappings.
The solution should identify the current User ID at runtime and determine the list of journal templates assigned to that user before allowing access to journal pages.
This ensures that users can only access authorized templates for viewing, entry, and posting, while preventing access to unauthorized templates. It reduces the risk of incorrect postings, improves data governance, and supports internal compliance and audit requirements.

1. Problem Statement
In Business Central, there is no event in TemplateSelection and OpenJnlBatch after template selection to validate user access.
Because of this, user-specific checks cannot be applied, and unauthorized users may access restricted journal templates.
An event is required after template selection to implement this validation.

Events Summary
We require Microsoft to extend the standard procedures TemplateSelection and OpenJnlBatch in Codeunit 240 (ItemJnlManagement) to provide an integration event after journal template selection, enabling user-specific validation of journal template access.

To be added in procedure:-
• TemplateSelection : Add a new integration event after template selection and before applying filters.
Required Event Placement
After:
if JnlSelected then begin

Image

Proposed Event
[IntegrationEvent(false, false)]
local procedure OnAfterTemplateSelection(var ItemJnlTemplate: Record "Item Journal Template"; var ItemJnlLine: Record "Item Journal Line"; var JnlSelected: Boolean)
begin
end;

Image

To be added in procedure:-
• OpenJnlBatch : Add a new integration event exactly after the selection check and before applying the filter.
Required Event Placement
After:
if not JnlSelected then
Error('');

Image

Proposed Event
[IntegrationEvent(false, false)]
local procedure OnAfterJournalTemplateSelection(var ItemJnlTemplate: Record "Item Journal Template"; var ItemJnlBatch: Record "Item Journal Batch")
begin
end;

Image

Purpose of These Events:
• OnAfterTemplateSelection
This event will allow adding user-specific validation logic after journal template selection and before applying filters on the Item Journal Line.
• OnAfterJournalTemplateSelection
This event will allow adding user-specific validation logic after template selection in the batch flow and before applying filters on the journal batch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions