[Extensibility Request] Add OnBeforeRestrictGenJournalLineAfterModify event to RestrictGenJournalLineAfterModify in codeunit 1550 "Record Restriction Mgt."
Nobody has claimed this yet.
- Dominant language
- AL
- Stars
- 683
- Forks
- 459
- Avg merge
- 3d 26m
- Merged PRs (30d)
- 633
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate Codeunit 1550, "Record Restriction Mgt.", and read RestrictGenJournalLineAfterModify plus nearby integration events. Confirm the requested event receives Gen. Journal Line and xGen. Journal Line records with an IsHandled parameter, and verify that the existing restriction behavior remains unchanged when no subscriber handles the event.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100