Skip to content

[Bug]: [Extensibility Request] Add OnBeforeRestrictGenJournalLineAfterModify event to RestrictGenJournalLineAfterModify in codeunit 1550 "Record Restriction Mgt." #10468

Description

@manichoy

Describe the issue

Please add an integration event before the call to RestrictGenJournalLine(Rec) in procedure RestrictGenJournalLineAfterModify of Codeunit 1550 "Record Restriction Mgt."

Some extensions need to modify General Journal Lines programmatically after posting preparation or during custom processing.

When a General Journal Line is modified, the standard Record Restriction logic is automatically executed through RestrictGenJournalLineAfterModify. Currently there is no extensibility point available to:

Skip the restriction logic under specific business scenarios.
Override the standard restriction behaviour.
Execute custom validation before the restriction is applied.

Without an event, partners must modify data in ways that are difficult to control and cannot cleanly integrate with the standard restriction framework.

Expected behavior

An extensibility event should be available before RestrictGenJournalLine(Rec) is executed, allowing extensions to intercept the standard restriction process.

The event should:

Provide access to both Gen. Journal Line and xGen. Journal Line records.
Expose an IsHandled parameter so extensions can suppress the standard call to RestrictGenJournalLine(Rec) when required.
Allow partners to implement alternative restriction logic or business-specific validation.
Preserve existing behavior when no subscribers are implemented.

Steps to reproduce

Add a new Integration Event named:
OnBeforeRestrictGenJournalLineAfterModify
in the following procedure:

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAfterModifyEvent', '', false, false)]
procedure RestrictGenJournalLineAfterModify(var Rec: Record "Gen. Journal Line"; var xRec: Record "Gen. Journal Line"; RunTrigger: Boolean)
begin
    if Format(Rec) = Format(xRec) then
        exit;

    RestrictGenJournalLine(Rec);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeRestrictGenJournalLineAfterModify(
    var GenJournalLine: Record "Gen. Journal Line";
    xGenJournalLine: Record "Gen. Journal Line";
    var IsHandled: Boolean)
begin
end;

Resulting Code

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAfterModifyEvent', '', false, false)]
procedure RestrictGenJournalLineAfterModify(var Rec: Record "Gen. Journal Line"; var xRec: Record "Gen. Journal Line"; RunTrigger: Boolean)
var
    IsHandled: Boolean;
begin
    if Format(Rec) = Format(xRec) then
        exit;

    OnBeforeRestrictGenJournalLineAfterModify(Rec, xRec, IsHandled);

    if IsHandled then
        exit;

    RestrictGenJournalLine(Rec);
end;
`

Additional context

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    IntegrationGitHub request for Integration area

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions