Dynamics 365 Business Central: How to prevent users from uploading duplicate files as attachments (Duplicate file names)
Preventing duplicate file attachments in Business Central requires customization because the standard allows the same file to be uploaded multiple times. The post demonstrates a solution using a table extension to add a setting and an event subscriber to block duplicate file names based on configuration.

post Dynamics 365 Lab
"In the standard Business Central, it is allowed to upload the same file multiple times, which means duplicate files."
Key points
- Standard Business Central allows uploading duplicate files with the same name to attachments
- The AllowDuplicateFileName variable in table 1173 Document Attachment controls this behavior but has no UI setting
- No standard event forces this value, so customization is needed
- Solution uses a table extension to General Ledger Setup plus an event subscriber on OnInsertAttachmentOnBeforeImportStream
Quotes
- “In the standard Business Central, it is allowed to upload the same file multiple times, which means duplicate files.” (Identifies the core problem that needs to be solved)
- “There is no Allow Duplicate FileName setting in the BC, and there is no event to force the value of this variable.” (Explains why standard configuration alone cannot solve this problem)
- “So this can’t be done in the standard, and requires some simple customization.” (Clarifies that a code-based solution is necessary)
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.
- Allow Posting Date Formula — possibly related: both name Table 98 “General Ledger Setup”
- Allow Posting From/To DateFormula: No More Monthly Date Updates from Business Central v28 — possibly related: both name Table 98 “General Ledger Setup”
- Automating Posting Periods in Business Central with Date Formulas — possibly related: both name Table 98 “General Ledger Setup”
- Business Central 2026 release wave 1 (BC28): Calculate withholding taxes for vendors (Withholding Tax) — possibly related: both name Table 98 “General Ledger Setup”
- Control Deferral Posting — possibly related: both name Table 98 “General Ledger Setup”
- Dynamics 365 Business Central: “Hide Company Bank Account” setup in General Ledger Setup (Update Company Bank Account on posted documents) — possibly related: both name Table 98 “General Ledger Setup”
- Dynamics 365 Business Central: Convert Word (.docx) To HTML (.html) within BC (No control add-in and APIs) — possibly related: both name Table 1173 “Document Attachment”
- 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 Table 1173 “Document Attachment”
- How to Use Date Formulas for Allowed Posting Periods in Business Central BC28. — possibly related: both name Table 98 “General Ledger Setup”
- New Application Ideas of Dynamics 365 Business Central (2025 MAY) — possibly related: both name Table 1173 “Document Attachment”
Context
- Features: file attachments, duplicate file detection, document attachment management, drag and drop upload
- Versions: Business Central 2024 wave 2, BC25
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.