Use the Page Management codeunit instead of invoking Page.Run directly (AC0006)
Direct calls to Page.Run bypass the centralized logic provided by the Page Management codeunit. Using Page Management improves correctness and extensibility by automatically resolving the appropriate page based on record context, table relationships, and configuration.
The Page Management codeunit provides a single point of control for page selection logic, making it easier to extend and customize page navigation behavior across the application.
A code fix is available for this diagnostic.
Example
The following code directly invokes Page.Run:
codeunit 50100 MyCodeunit
{
procedure ShowSalesHeader(var SalesHeader: Record "Sales Header")
begin
Page.Run(Page::"Sales Order", SalesHeader); // Invoke pages through the "Page Management" codeunit instead of invoking Page.Run(...) directly for this record context. [AC0006]
end;
}
To fix this, use the Page Management codeunit:
codeunit 50100 MyCodeunit
{
procedure ShowSalesHeader(var SalesHeader: Record "Sales Header")
var
PageManagement: Codeunit "Page Management";
begin
PageManagement.PageRun(SalesHeader);
end;
}