Hi Samantha73,
You can address this using an event subscriber to overwrite the custom name.
Subscribing to the following objects will give you the result you need:
OnBeforeGetAttachmentFileName
OnBeforeSaveAttachment
If you find this useful, feel free to mark this answer as suggested!
I've also created a GitHub repo with the code for you to check out.
https://github.com/jeffreybulanadi/D365-BusinessCentral-Community-Solutions/tree/c5f60ba2eac022fe4d0a8ae2eaea705df342a635/AL-Extensions/PrintPreviewCustomFileName Cheers Jeffrey Bulanadi
Hi, good day I hope this can help you, and give you some hints.
How to change the name of downloaded PDF?
How to translate attachment names - FORNAV
Microsoft Idea
Best Regards Gerardo
In Business Central, when using Print Preview, the default PDF file name may not include the document number. To ensure meaningful filenames during PDF downloads, here are a few approaches you can consider:
In AL, use the Report.SaveAs method.
Report.SaveAs
Dynamically pass the document number as part of the file name when saving the report.
File.View
Allows previewing a file before download.
You can adjust the logic so the downloaded file includes the document number in the name.
In Word or RDLC layouts, make sure the document number is visible in the header or footer.
This helps users identify and rename files more easily after download.
OnCustomDocumentMergerEx
Available in Business Central v21 or later.
Allows customization of the document merge and file naming before generation.
Mark below checkbox to make this answer Verified if it helps you.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Sohail Ahmed 2,725 Super User 2025 Season 2
Sumit Singh 2,610
Jeffrey Bulanadi 2,221