Dynamics 365 Business Central: How to quickly strip not supported chars in File Name via AL
Saving files from Business Central to external systems requires removing unsupported characters from file names. The post demonstrates using the StripNotsupportChrInFileName method from codeunit 419 to automatically clean file names before export.

post Dynamics 365 Lab
"When saving files in Windows or other systems, there are some characters that cannot be contained in file names."
Key points
- Windows and other systems restrict certain characters in file names (like # % & * : < > ? / \ | } ~ etc.)
- Business Central allows entering any characters without restriction, creating a mismatch when exporting files
- Codeunit 419 ‘File Management’ provides a built-in StripNotsupportChrInFileName method to sanitize file names
- An alternative method exists in codeunit 9458 ‘File Account Browser Mgt.’ for the same purpose
Quotes
- “When saving files in Windows or other systems, there are some characters that cannot be contained in file names.” (Explains the root cause of the problem developers face when exporting BC data to external systems)
- “However, there is no such restriction when entering data in BC.” (Highlights the gap between BC’s permissive input and external systems’ file naming restrictions)
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.
- Business Central 2026 release wave 1 (BC28): Storing Document Attachments outside the database (No customization) – See benefits of external storage support for document attachments — possibly related: both name Codeunit 9458 “File Account Browser Mgt.”
- Dynamics 365 Business Central: Convert Word (.docx) To HTML (.html) within BC (No control add-in and APIs) — possibly related: both name Codeunit 419 “File Management”
- Dynamics 365 Business Central: Convert Word (.docx) To PDF (.pdf) within BC (No control add-in and APIs) — possibly related: both name Codeunit 419 “File Management”
- Dynamics 365 Business Central: How to get the page number of a PDF or Word file in AL (Display the page count on Attached Documents and Doc. Attachment List Factbox) — possibly related: both name Codeunit 419 “File Management”
- Dynamics 365 Business Central: previewing PDF files in web client using the new ExtendedDataType = Document. — possibly related: both name Codeunit 419 “File Management”
- Step by Step Guide to Importing Excel Data into Business Central — possibly related: both name Codeunit 419 “File Management”
Context
- Features: StripNotsupportChrInFileName, filename sanitization
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.