community postIntegration & APIscommunity - not Microsoftreviewed - checked by Opus

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

Yun Zhu · 2025-08-14 · 245 words · about 1 min

"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.

No source states these links: they share an object, a model read them, or a person found the same subject.

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.