community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Dynamics 365 Business Central: How to substitute a page for another page via AL

Page substitution in Dynamics 365 Business Central allows developers to redirect users to a different page when opening a standard page using AL code. The post explains techniques such as using the Error method in OnOpenPage trigger and, starting with BC26, extending the CardPageId property for list pages.

post Dynamics 365 Lab

Yun Zhu · 2025-08-27 · 638 words · about 3 min

"Microsoft has not prepared any standard events in advance. So we have to solve this problem in other ways."

Key points

  • Unlike reports, pages lack standard substitution events, requiring custom solutions in OnOpenPage trigger
  • Using Error(‘’) after Page.Run() prevents the original page from opening, allowing seamless redirection
  • CurrPage.Close() in OnOpenPage does not work reliably and may display blank pages
  • Business Central 2025 wave 1 (BC26) introduced CardPageId property extension for easier card page substitution
  • For card and document pages in earlier versions, SetRecord and Run methods with Error() provide a workaround

Quotes

  • “Microsoft has not prepared any standard events in advance. So we have to solve this problem in other ways.” (Explains why custom solutions are needed instead of relying on built-in page substitution events like those available for reports)
  • “Using this method, we can allow users to jump to our customized page when they open the standard page.” (Summarizes the practical benefit of the Error method approach for seamless page redirection)
  • “Starting with Business Central 2025 wave 1 (BC26), this is no longer a problem, as we can extend the CardPageId Property.” (Highlights that BC26 introduced native support for card page substitution, simplifying the solution)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

Not found in BC28-30: page “ZY Customer Card”.

No source states these links: they share an object, a model read them, or a person found the same subject.

Heads up

  • gotcha: “CurrPage.Close() method does not work in trigger OnOpenPage().” (about OnOpenPage)
  • gotcha: “This will open the Payment Terms page first, then the Payment Methods page (Sometimes the page cannot be opened and displays blank page).”
  • breaking: “Starting with Business Central 2025 wave 1 (BC26), this is no longer a problem, as we can extend the CardPageId Property.” (about other CardPageId Property, version BC26)

Context

  • Features: Page substitution via AL, PageExtension with OnOpenPage trigger, CardPageId property, Page.Run method, Error method for page redirection, SetRecord method, Editable property control
  • Versions: Business Central 2025 wave 1, BC26

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.