---
id: change/bcquality/147
type: change
title: "#147 ShowMandatory + OnQueryClosePage Check"
summary: Two new UI community knowledge articles with code examples demonstrate best practices for marking required fields and validating request page input to prevent common defects like fields appearing optional or losing user input on validation errors.
tier: official
language: en
tags:
  - feature
  - main
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:06:37.215Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 182180913e6c90b62e6c2a65f13371e53c7adb5e
evidence:
  - kind: code
    url: https://github.com/microsoft/BCQuality/pull/147
    title: "microsoft/BCQuality#147: ShowMandatory + OnQueryClosePage Check"
    date: "2026-09-02"
    commit: 182180913e6c90b62e6c2a65f13371e53c7adb5e
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 147
repo: microsoft/BCQuality
source_id: bcquality-prs
url: https://github.com/microsoft/BCQuality/pull/147
kind: pr
base_branch: main
major: null
merged_at: "2026-09-02T13:21:07Z"
author: pri-kise
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: feature
behavior_change: false
breaking: false
files:
  count: 6
  additions: 342
  deletions: 0
  al: 6
apps: []
objects_touched: []
objects_unjoined:
  - path: community/knowledge/ui/showmandatory-on-code-required-page-fields.bad.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/ui/showmandatory-on-code-required-page-fields.good.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/ui/showmandatory-on-code-required-page-fields.md
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/ui/validate-request-page-input-in-onqueryclosepage.bad.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/ui/validate-request-page-input-in-onqueryclosepage.good.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/ui/validate-request-page-input-in-onqueryclosepage.md
    status: added
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - development
quote: null
joined_against:
  major: null
  commit: null
---

# #147 ShowMandatory + OnQueryClosePage Check

> Two new UI community knowledge articles with code examples demonstrate best practices for marking required fields and validating request page input to prevent common defects like fields appearing optional or losing user input on validation errors.

[Pull request](https://github.com/microsoft/BCQuality/pull/147) · merged into `main` on 2026-09-02 by pri-kise · 6 files (+342 -0), 6 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- ShowMandatory only draws the asterisk and TestField or NotBlank only enforce, so a required field needs both
- The problem is worst on DelayedInsert list pages, where the error appears only after the user leaves the row
- OnPreReport runs after the request page closes, so validate in OnQueryClosePage too to keep the user's input
- Guard the OnQueryClosePage check on CloseAction so Cancel does not trap the user, and keep the OnPreReport check for runs with no request page
- Both articles include bad and good AL samples

## AL objects touched

- `community/knowledge/ui/showmandatory-on-code-required-page-fields.bad.al`: added, not in the BC? snapshot yet
- `community/knowledge/ui/showmandatory-on-code-required-page-fields.good.al`: added, not in the BC? snapshot yet
- `community/knowledge/ui/showmandatory-on-code-required-page-fields.md`: added, not in the BC? snapshot yet
- `community/knowledge/ui/validate-request-page-input-in-onqueryclosepage.bad.al`: added, not in the BC? snapshot yet
- `community/knowledge/ui/validate-request-page-input-in-onqueryclosepage.good.al`: added, not in the BC? snapshot yet
- `community/knowledge/ui/validate-request-page-input-in-onqueryclosepage.md`: added, not in the BC? snapshot yet

## Context

- Systems: development

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
