Dynamic Business central 365: Understanding the CharAllowed Property with Example.
Before using it in practice, it is important to clearly understand what Microsoft means by CharAllowed, how it behaves internally, and where its limitations lie.
What Is the CharAllowed Property
The CharAllowed property defines the range of characters that a user is permitted to enter into a field or page control.
Key characteristics:
-
It is a UI-level validation property
-
It applies to Table fields and Page fields
-
Validation is performed only during user interaction
-
It does not execute during programmatic assignments
How Character Ranges Work
1. Allowing Only Uppercase Letters
CharAllowed = 'AZ';
Result:
- Allowed: A to Z
- Rejected: lowercase letters, numbers, special characters
This is commonly used for:
- Codes
- Identifiers
- Abbreviations
2. Allowing Both Uppercase and Lowercase Letters
If CharAllowed is left blank, Business Central allows:
- Uppercase letters
- Lowercase letters
- Numbers
- Special characters (depending on field type)
There is no implicit validation unless the property is explicitly defined.
3. Multiple Character Ranges
You can specify multiple allowed ranges by entering them in pairs.
Example:
CharAllowed = 'admpzz';
This is interpreted as:
- a–d
- m–p
- z–z
Allowed characters:
- a, b, c, d
- m, n, o, p
- z
This approach is useful when you want tight control over allowed values without writing custom validation code.
4. Allowing a Single Character
To allow only one specific character, repeat it twice:
CharAllowed = 'XX';
This allows:
- Only X
This can be useful for:
- Flags
- Fixed format fields
- Controlled indicators
Where CharAllowed Is Validated
This is the most important part to understand.
Validation Occurs When:
-
A user enters or edits a value on a page
-
A value is entered manually into a table field via UI
Validation Does NOT Occur When:
-
The field value is assigned through AL code
-
The field is updated through AL code, including assignments using
Rec.Validate() -
The field is populated during data migration or background processing
Example:
Page Extension:
When to Use CharAllowed
Recommended use cases:
-
UI-level data hygiene
-
Code fields
-
Identifiers
-
Reference numbers
-
Preventing accidental invalid input
Not recommended as the only validation mechanism when:
-
Data can be inserted via code
-
Data integrity is business critical
The CharAllowed property is a simple yet powerful tool for preventing invalid user input at the UI level in Business Central. However, it should be viewed as a first line of defense, not a complete validation strategy. Understanding its scope and limitations allows developers to design cleaner pages, reduce unnecessary validation code, and improve overall user experience without compromising data integrity.
Thanks For Reading...!!
Regards,
Khushbu Rajvi
This was originally posted here.

Like
Report
*This post is locked for comments