Skip to content

[Event Request] - Page 5730 "Item Categories" - OnBeforeCheckPresentationOrder #30176

@meadowGarden

Description

@meadowGarden

Why do you need this change?

Target: Page 5730 "Item Categories"

Event Placement in trigger OnOpenPage:

trigger OnOpenPage()
var
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeCheckPresentationOrder(IsHandled);  // new event
    if not IsHandled then
        ItemCategoryManagement.CheckPresentationOrder();
end;

Business Justification:
OnOpenPage calls ItemCategoryManagement.CheckPresentationOrder() on every page open. For tenants with large item category trees, this triggers UpdatePresentationOrder() - a full tree traversal - whenever any item category has "Presentation Order" = 0. This is a significant performance bottleneck on page open.

CheckPresentationOrder() is also called from Page 5733 "Item Category Card" OnQueryClosePage to maintain consistency after card edits. An event in Codeunit 5722 would suppress both call sites indiscriminately. Extensions that need to suppress only the page-open rebuild - while preserving the post-edit rebuild on the card - have no targeted interception point.

A page-level event on OnOpenPage is the precise and minimal solution: it suppresses only the automatic check on list open, leaves OnQueryClosePage behavior on the card unchanged, and leaves the manual Recalculate action unaffected (which calls UpdatePresentationOrder() directly).

Alternatives Evaluated:

  • OnBeforeCheckPresentationOrder (non existant, just a thought experiment) in Codeunit 5722: Suppresses all callers of CheckPresentationOrder(), including Page 5733 OnQueryClosePage. Too broad for extensions that only want to suppress the page-open cost.

  • OnBeforeUpdatePresentationOrderIterative in Codeunit 5722 with IsHandled := true: Does not prevent the data load in UpdatePresentationOrder(). The FindSet across all item categories and temp table population still execute before the event fires.

  • Page extension OnOpenPage: Runs after the base trigger - CheckPresentationOrder() has already executed. Cannot prevent the call.

Performance Considerations:
Fires once per page open. When IsHandled := true, no database access occurs at all. Cost is lower than the current baseline.

Data Sensitivity Review:
No parameters beyond IsHandled. No data exposure.

Multi-Extension Interaction:
Standard IsHandled pattern. First subscriber to set IsHandled := true suppresses execution. Multiple subscribers coexist in dependency order.

Describe the request

[IntegrationEvent(false, false)]
local procedure OnBeforeCheckPresentationOrder(var IsHandled: Boolean)
begin
end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions