Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Attachments in Business Central

(0) ShareShare
ReportReport
Posted on by 215

Hi,

Noticed that when attaching a file to an order or invoice business central auto renames the file if the file with same name exists.

Earlier it used to reject the attachment.

Does anyone know if we can prevent uploading of file if the file with same name exists?

Appreciate any help.

Regards,

SM

  

  • ShaishavM Profile Picture
    ShaishavM 215 on at
    RE: Attachments in Business Central

    Hi Narang,

    Thanks for your detailed reply and I concur with the logic.

    What I fail to understand is that why to change the behaviour without giving prior intimation.

    Our current workflow is designed based on the limitation system had.

    While I welcome the change, I believe the customer should be given time to transition instead being forced to accept the change.

    Anyway, from your reply I gather there is no way to change the behaviour.

    Regards,

    SM

  • Suggested answer
    NAV_with_Narang Profile Picture
    NAV_with_Narang 2,238 Moderator on at
    RE: Attachments in Business Central

    While dealing with files, technically it becomes tricky to conclude that Same Name = Same Content, because of which not just BC but several other ERP systems are now revamping their file storing logic. If you take a look at the file storing logic of your PC, if you store 2 files with the name "Test File" the second file automatically adapts the name "Test File - Copy". So what you're experiencing with BC today, has been a standard feature in all Operating Systems since ages

    If you/your customer does not want this behavior in BC, you can write a AL Code Extension, which triggers when the file upload button/action is undertaken from the UI. If the file that is incoming has a exact same name in comparison to the file which is already uploaded, you can give an option to the user to either overwrite existing or terminate operation to avoid duplication

    1. If you present an option to the user to be able to overwrite, your AL logic should first delete the existing file and then upload the new one which is incoming. To uphold data integrity, you can only allow overwrite (delete existing & insert new) if the earlier file was also uploaded by the same user uploading the new file

    2. However looking at the second option, if you don't allow the user to store a second file with the same name, he/she may try to bypass that by manually changing the file name, as simply as introducing a space in the name somewhere in the name

    You would need customization to enable this, which is clear as of now. You may find a handful of blogs, which you can merge together and create your AL code but customizing for files in BC can go really ugly - real fast if not taken care of. It may even end up slowing down the whole operation, so ensure that the time you'll be investing doesn't end up driving you down a rabbit hole

  • ShaishavM Profile Picture
    ShaishavM 215 on at
    RE: Attachments in Business Central

    Hi Nitin,

    Thanks, but we also don't want to create a copy of the file.

    Is there a way we can manage this behaviour?

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,271 Moderator on at
    RE: Attachments in Business Central

    Yes it will not overwrite.

    Thanks

  • ShaishavM Profile Picture
    ShaishavM 215 on at
    RE: Attachments in Business Central

    Hi Nitin,

    Thanks for your reply.

    It used to work earlier, meaning Business Central didn't allow overwriting the file.

    Now it just creates a duplicate file.

    Regards,

    SM

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,271 Moderator on at
    RE: Attachments in Business Central

    In standard system you can not stop that, you have to write your own logic to prevent this.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans