bcquality/microsoft/knowledge/style/caption-required-on-page-fields.md
Jesper Schulz-Wedde 8584217c75
Some checks failed
Validate knowledge index / validate-index (push) Has been cancelled
Validate AL review fixtures / validate-review-fixtures (push) Has been cancelled
Validate frontmatter and structure / validate (push) Has been cancelled
Clarify page field caption and tooltip inheritance (#160)
* Clarify page field caption and tooltip inheritance

Prevent redundant page-level properties by documenting inherited captions and BC24/runtime 13.0 table-field tooltips. Correct companion examples and version-scoped tooltip guidance.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Address tooltip quality and knowledge scope review feedback

Require useful, behavior-grounded tooltip text rather than caption repetition, improve the samples, and explain why compiler feedback does not prevent redundant page captions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-07 15:13:35 +02:00

3.1 KiB

bc-version domain keywords technologies countries application-area
all
style
caption
page-field
source-field
inheritance
aa0225
aa0226
codecop
captionclass
false-positive
al
w1
all

Page fields can inherit their source table field's Caption

Description

A page field bound to a table field inherits the source field's Caption unless the page overrides it. An inherited caption is valid, user-facing, and translatable; omitting a page-level Caption does not mean the control displays an internal identifier or loses translations. CodeCop AA0225/AA0226 concern missing or empty captions, not a requirement to duplicate a caption already supplied by the source table field.

Redundant page-level captions compile successfully, so compiler-error recovery does not prevent an agent from adding them. This guidance prevents that false positive rather than replacing analyzer diagnostics.

Controls bound to variables or expressions cannot rely on table-field caption inheritance. For user-facing fields that need a label, supply a Caption or a CaptionClass that resolves to the intended caption. API pages are not human-facing UI; do not apply this UI-label guidance to their API contract names.

Best Practice

Define the shared caption on the table field and let bound page fields inherit it. Add a page-level Caption only when there is no suitable inherited caption or the page genuinely needs different wording. Keep a valid CaptionClass rather than adding a redundant literal caption.

Before reporting a missing caption, inspect the binding and source field, including dependency symbols when needed. If the source definition is unavailable, do not treat an omitted page property as proof that the caption is missing. Caption and tooltip requirements are separate: do not add a ToolTip just because a caption is being reviewed; see tooltip inheritance guidance.

See sample: caption-required-on-page-fields.good.al. Caption inheritance applies across BC versions; the sample uses BC24/runtime 13.0 or later to also define tooltips on its table fields.

Anti Pattern

A user-facing field that needs a label but has no non-empty explicit or inherited caption and no resolving CaptionClass has a genuine labeling gap. This includes Caption = ''; when no CaptionClass supplies the label. A variable name alone is not a translatable caption.

The opposite review defect is flagging a bound field solely because it omits a page-level Caption, or inserting a copy of the table field's caption to satisfy AA0225/AA0226. That adds redundant text and prevents subsequent table-caption changes from flowing through to the page.

See sample: caption-required-on-page-fields.bad.al.

References

Caption property and ToolTip property remarks documenting inheritance of both properties.