---
id: post/yzhums-com/71582
type: post
title: "Dynamics 365 Business Central: How to show or hide subform fields based on a value in the main page"
summary: 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.
tier: community
language: en
tags:
  - subform fields
  - dynamic visibility
  - user interface
  - al development
  - page extensions
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-26T06:40:32.511Z"
  flags: []
generated:
  at: "2026-10-30T07:47:07.587Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: b182fb1c7171e2edb573d6cefd9f42ba865e5030c66725bae08b33b423f89992
evidence:
  - kind: blog
    url: https://yzhums.com/71582/
    title: "Dynamics 365 Business Central: How to show or hide subform fields based on a value in the main page"
    date: "2026-04-01"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://yzhums.com/71582/
    title: "Dynamics 365 Business Central: How to show or hide subform fields based on a value in the main page"
    date: "2026-04-01"
    commit: null
    t: null
    quote: In Dynamics 365 Business Central development, creating a responsive UI is key to a great user experience.
links:
  learn: []
  objects:
    - object/table/36
    - object/page/42
    - object/page/46
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  related:
    - to: video/Vq9Nk6_uxmQ
      title: "Business Central Under the Hood episode 14: Building Agents in Business Central"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/mohana-blog/tag-blogger-com-1999-blog-1492436440038408053-post-7334878023159275001--89079995d0
      title: Create Purchase Orders from Drop Shipments
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: video/tpAh4q3h8T8
      title: "Directions EMEA 2023 Keynote: Business Central saves time for consultants and power users"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/yzhums-com/74523
      title: "Dynamics 365 Business Central Blog Series: Item Attributes"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/yzhums-com/65320
      title: "Dynamics 365 Business Central: About the size of the value displayed on the card/document page (textbox too small to read?)"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/yzhums-com/70137
      title: "Dynamics 365 Business Central: Adding comments to Factbox/Report (Displaying Comments in a FactBox/Report)"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/yzhums-com/69476
      title: "Dynamics 365 Business Central: All Copilot and agent capabilities"
      label: possibly related
      why: both name Page 46 "Sales Order Subform"
      by: code
    - to: post/yzhums-com/66037
      title: "Dynamics 365 Business Central: Can we edit data directly in FactBox?"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/yzhums-com/56521
      title: "Dynamics 365 Business Central: How to hide/disable New, Edit (Edit List), and Delete actions on the page"
      label: possibly related
      why: both name Page 42 "Sales Order"
      by: code
    - to: post/yzhums-com/25134
      title: "Dynamics 365 Business Central: How to note the records that the user has selected on the Subpage/Lines (Page.SetSelectionFilter in part)"
      label: possibly related
      why: both name Page 46 "Sales Order Subform"
      by: code
post_id: "71582"
source_id: yzhums-com
source_name: Dynamics 365 Lab - Yun Zhu
url: https://yzhums.com/71582/
published_at: "2026-04-01T03:04:37.000Z"
author: Yun Zhu
full_text: false
words: 351
quotes:
  - text: In Dynamics 365 Business Central development, creating a responsive UI is key to a great user experience.
    why_it_matters: Sets the context that dynamic UI control is essential for user experience in Business Central development
code_objects_mentioned:
  - table Sales Header
  - page Sales Order
  - page Sales Order Subform
systems:
  - development
  - sales
  - platform
versions_mentioned: []
preview:
  embeddable: true
  frame_url: null
  image: https://yzhums.com/wp-content/uploads/2026/04/Snipaste_2026-04-01_11-58-44.png
  image_alt: null
  image_w: null
  image_h: null
  site_name: Dynamics 365 Lab
  favicon: https://yzhums.com/wp-content/uploads/2020/08/cropped-logo-3-32x32.png
  probed_at: "2026-10-26T06:06:38.797Z"
---

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

[Read the post](https://yzhums.com/71582/) · Dynamics 365 Lab - Yun Zhu (Yun Zhu, MVP) · 2026-04-01 · 351 words · tier community · reviewed (checked by Opus)

> 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.

## 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.

- [table 36 "Sales Header"](../../objects/table/36.md)
- [page 42 "Sales Order"](../../objects/page/42.md)
- [page 46 "Sales Order Subform"](../../objects/page/46.md)

## Possibly related

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

- [Business Central Under the Hood episode 14: Building Agents in Business Central](../../videos/Vq9Nk6_uxmQ.md) — possibly related: both name Page 42 "Sales Order"
- [Create Purchase Orders from Drop Shipments](../../posts/mohana-blog/tag-blogger-com-1999-blog-1492436440038408053-post-7334878023159275001--89079995d0.md) — possibly related: both name Page 42 "Sales Order"
- [Directions EMEA 2023 Keynote: Business Central saves time for consultants and power users](../../videos/tpAh4q3h8T8.md) — possibly related: both name Page 42 "Sales Order"
- [Dynamics 365 Business Central Blog Series: Item Attributes](../../posts/yzhums-com/74523.md) — possibly related: both name Page 42 "Sales Order"
- [Dynamics 365 Business Central: About the size of the value displayed on the card/document page (textbox too small to read?)](../../posts/yzhums-com/65320.md) — possibly related: both name Page 42 "Sales Order"
- [Dynamics 365 Business Central: Adding comments to Factbox/Report (Displaying Comments in a FactBox/Report)](../../posts/yzhums-com/70137.md) — possibly related: both name Page 42 "Sales Order"
- [Dynamics 365 Business Central: All Copilot and agent capabilities](../../posts/yzhums-com/69476.md) — possibly related: both name Page 46 "Sales Order Subform"
- [Dynamics 365 Business Central: Can we edit data directly in FactBox?](../../posts/yzhums-com/66037.md) — possibly related: both name Page 42 "Sales Order"
- [Dynamics 365 Business Central: How to hide/disable New, Edit (Edit List), and Delete actions on the page](../../posts/yzhums-com/56521.md) — possibly related: both name Page 42 "Sales Order"
- [Dynamics 365 Business Central: How to note the records that the user has selected on the Subpage/Lines (Page.SetSelectionFilter in part)](../../posts/yzhums-com/25134.md) — possibly related: both name Page 46 "Sales Order Subform"

## 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.
