Dynamics 365 Business Central: How to quickly remove Non-Alphanumeric Characters in AL
The post shows how to strip non-alphanumeric characters from text in Business Central AL using the standard codeunit 47 StringConversionManagement and its RemoveNonAlphaNumericCharacters procedure. A page extension example on the Customer Card cleans the Name field in its OnBeforeValidate trigger, so only letters and digits are kept.

post Dynamics 365 Lab
"we can use the standard codeunit 47 StringConversionManagement"
Key points
- Use codeunit 47 StringConversionManagement and its RemoveNonAlphaNumericCharacters method to filter strings
- The method leaves only letters A-Z and numbers 0-9, removing special characters, symbols, spaces, and emoji
- Can be applied in page extensions using OnBeforeValidate triggers to clean data during user input
- Offers a cleaner built-in solution compared to custom methods for handling non-alphanumeric character removal
Quotes
- “we can use the standard codeunit 47 StringConversionManagement” (Identifies the specific built-in tool developers should use instead of creating custom solutions)
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.
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Understanding AL Development: String Conversion Management Code Unit — possibly related: both name Codeunit 47 “StringConversionManagement”
Context
- Features: RemoveNonAlphaNumericCharacters method, input validation, string conversion
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.