AL icon indicating copy to clipboard operation
AL copied to clipboard

Overwrite standard page for table 38 "Purchase Header" using codeunit 700 "Page Management" and its event subscribers in bc 23.5 and 24.0

Open SilMueller opened this issue 10 months ago • 0 comments

We looked for possibilities to use a custom page, instead of the BC standard page, when opening "Purchase Invoices". We tried using the event subscriber "OnAfterGetPurchaseHeaderPageID" on the codeunit 700 "Page Management" as follows:

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Page Management", 'OnAfterGetPurchaseHeaderPageID', '', true, true)]
local procedure "Page Management_OnAfterGetPurchaseHeaderPageID"
(
    RecRef: RecordRef;
    PurchaseHeader: Record "Purchase Header";
    var Result: Integer
)
begin
    Result := 50000;
end;

We also tried the following event subscriber:

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Page Management", 'OnAfterGetPageID', '', false, false)]
local procedure "Page Management_OnAfterGetPageID"(var RecordRef: RecordRef; var PageID: Integer)
begin
    PageID := 50000;
end;

We added breakpoints to each of these events and tried opening the table 38 in our BC enviroment. Neither our custom page 50000 open, nor did one of our breakpoints trigger in the event subscribers above trigger.

Is this a common/known issue? Is there something we need to enable on our BC enviroment? Or is there a better way to solve this issue?

Thank you in advance.

SilMueller avatar Apr 30 '24 14:04 SilMueller