Skip to content

Add OnBeforeForceShowNoSeriesForDocNo override hook in DocumentNoVisibility - #30184

Closed
Magnus Hartvig Grønbech (Groenbech96) with Copilot wants to merge 1 commit into
mainfrom
copilot/add-onbeforeforceshownoseriesfordocno-event
Closed

Add OnBeforeForceShowNoSeriesForDocNo override hook in DocumentNoVisibility#30184
Magnus Hartvig Grønbech (Groenbech96) with Copilot wants to merge 1 commit into
mainfrom
copilot/add-onbeforeforceshownoseriesfordocno-event

Conversation

Copilot AI commented Jun 1, 2026

Copy link
Copy Markdown

ForceShowNoSeriesForDocNo had hardcoded visibility logic with no extensibility point for full override. This change introduces an IsHandled integration event at method entry so extensions can replace the visibility decision for specific No. Series scenarios.

  • What changed

    • Added IsHandled and DocNoVisible locals to ForceShowNoSeriesForDocNo.
    • Invoked new publisher OnBeforeForceShowNoSeriesForDocNo(NoSeriesCode, DocNoVisible, IsHandled) at the start of the procedure.
    • Added early exit when IsHandled is set, returning subscriber-provided DocNoVisible.
    • Kept existing base logic unchanged when not handled.
  • New extensibility point

    • Added integration event in DocumentNoVisibility:
      • OnBeforeForceShowNoSeriesForDocNo(NoSeriesCode: Code[20]; var DocNoVisible: Boolean; var IsHandled: Boolean)
procedure ForceShowNoSeriesForDocNo(NoSeriesCode: Code[20]): Boolean
var
    NoSeries: Record "No. Series";
    NoSeriesRelationship: Record "No. Series Relationship";
    NoSeriesBatch: Codeunit "No. Series - Batch";
    SeriesDate: Date;
    IsHandled: Boolean;
    DocNoVisible: Boolean;
begin
    IsHandled := false;
    OnBeforeForceShowNoSeriesForDocNo(NoSeriesCode, DocNoVisible, IsHandled);
    if IsHandled then
        exit(DocNoVisible);

    // existing standard logic remains unchanged
end;

Copilot AI changed the title [WIP] Add OnBeforeForceShowNoSeriesForDocNo event in DocumentNoVisibility Add OnBeforeForceShowNoSeriesForDocNo override hook in DocumentNoVisibility Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Event Request] codeunit 1400 DocumentNoVisibility procedure ForceShowNoSeriesForDocNo event OnBeforeForceShowNoSeriesForDocNo

2 participants