web
You’re offline. This is a read only version of the page.
close
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

Using dynamic file name (i.e. sales order number) while downloading sales confirmation report

(0) ShareShare
ReportReport
Posted on by

When a sales confirmation (sales order) is downloaded, the file is named document.pdf. I like to use dynamic name here. Instead of document.pdf, it should be sales-order-number.pdf. 

I tired but I could not correctly find a code-unit that is responsible to provide the document name. I really appreciate if someone can help me to figure out what exactly needs to be done here to achieve dynamic naming of the documents being downloaded.

Thanks.

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 on at

    When you email it the document number is added. If you need it on a pdf print create a new page action that uses the saveaspdf function. Within that you can set the file name. docs.microsoft.com/.../saveaspdf-function--report-

  • Suggested answer
    JAngle Profile Picture
    133 on at

    Report selections table has a function saveaspdf it has an event. This is the one that accessed file management CU to determine a file name. Worth checking out if you intend to alter standard behaviour.

  • mbharodia Profile Picture
    on at

    Hi Josh:

    Thanks a lot for giving me some insight. Let me have a look at it. Good day!

  • mbharodia Profile Picture
    on at

    Josh:

    I have checked list of events raised during downloading "sales confirmation" document report. I have used "event recorder" to get this list. None of the invents raised include "OnBeforeSaveReportPDF". Most of events are related with PrintDocument such as "OnBeforePrintDocument". They don't expose any property that I could use to alter file name that should be used while downloading the document. If there was an event raised for "OnBeforeSaveReportPDF", then it could have been simpler for me to change the behavior. This event exposes a FilePath property. That might help.

    In this situation, I believe that I am left with adding a new page action that should use SavePDF function. If I had a choice, I would have still preferred subscribing to the event. This way I can alter the behavior to all the reports I like at one place. Adding a page action needs me to add as many actions as many reports I like to update. This invites duplication of efforts and redundancy.

    Anyways... I appreciate your help and advice. Thanks

  • Suggested answer
    Salah Eddine BENOUALA Profile Picture
    485 on at

    Hi,

    I already faced the same problem to alter file name before downloading the document. I created a support ticket for Microsoft and unfortunately they answered me saying that this requirement can't be achieved in standard through event, neither captions modification of the report at runtime.

    They suggested to add this as an idea. This is what I've done and I'm waiting for votes to be rised.

    You can vote also from here : https://experience.dynamics.com/ideas/idea/?ideaid=2216aa75-4309-eb11-b5d9-0003ff68c1de

    Thank you,

    -----------------------------------------

    Best Regards,

    Salah Eddine BENOUALA

    Dynamics NAV & 365 Business Central Consultant

    Please verify my answer, if you find it helpful.

    Doing so you'll show others that there was found a solution and you credit my help.

  • mbharodia Profile Picture
    on at

    Okay. Thanks. I have added my vote for this.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans