community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Dynamics 365 Business Central: How to show or hide subform fields based on a value in the main page

This post explains how to dynamically show or hide subform fields based on a value in the main page of a Sales Order, using a custom field and page extension logic in AL code to create a responsive user interface.

post Dynamics 365 Lab

Yun Zhu · 2026-04-01 · 351 words · about 2 min

"In Dynamics 365 Business Central development, creating a responsive UI is key to a great user experience."

Key points

  • Add a custom Boolean field to the main page (Sales Header) to control visibility state
  • Use page extensions to modify subform fields and implement a SetShowItemInfo procedure
  • Implement OnValidate and OnOpenPage triggers to update field visibility in real time when the main page field changes
  • The example demonstrates hiding or showing Item No., Item Reference No., and Description fields in the Sales Order Subform

Quotes

  • “In Dynamics 365 Business Central development, creating a responsive UI is key to a great user experience.” (Sets the context that dynamic UI control is essential for user experience in Business Central development)

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.

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

Context

  • Features: dynamic field visibility, page extensions, table extensions, field modifications, real-time UI updates, responsive UI

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.