community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Dynamics 365 Business Central: How to set the minimum and maximum numeric values ​​for a field

Business Central offers two simple ways to limit numeric field values: the MinValue and MaxValue properties on table or page fields, or custom range checks in OnValidate triggers. The properties are only checked when values change through the UI, not when application code sets the field, and they cannot exclude the boundary values.

post Dynamics 365 Lab

Yun Zhu · 2025-10-30 · 526 words · about 2 min

Key points

  • MinValue and MaxValue on a table or page field enforce an inclusive range and show a standard error when a value falls outside it.
  • The property check runs for UI updates on pages or direct table edits, but not when application code assigns the value.
  • Properties cannot express strict bounds such as only values above zero.
  • An OnValidate trigger on the table field can hold custom range logic and raise an error; it runs before the page field OnValidate trigger.

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.

Heads up

  • gotcha: “If a field is updated through application code, then the MinValue/MaxValue property is not validated.”

Context

  • Features: MinValue Property, MaxValue Property, OnValidate Trigger, Field Validation

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.