web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

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

How to change the name of downloaded PDF?

(1) ShareShare
ReportReport
Posted on by

Hi all,

I have a concern that when I download report from BC, the report always named after the report name.

pastedimage1615436405615v1.png

For example, I will have Sales - Shipment (1), Sales - Shipment (2), Sales - Shipment (3) and etc.. And my teams spend a lot time to renaming them in their device after downloading the file. If there any ways I can customize the PDF file naming right after downloading from BC? I would like to have the names, for instance, Sales - Shipment_(Posted Sales Shipment."No.").

Thanks in advance!

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

    You could look at the report selections table and subscribing to OnBeforeSaveReportAsPDF. Worth considering if you choose email it adds the document no. to the file name, which I assume is what you want. If it cannot email it will download the file anyway. It may put the document number in that way

  • Suggested answer
    Hein Kruger Profile Picture
    666 on at

    Hi ,

    From BC21 there is a event subscriber that allows you to change the Filename from base app Report Selection per report.

    In Code unit “Custom Layout Reporting” we can use the eventsubscriber “OnGenerateFileNameOnAfterAssignFileName” to change the File name. The Code will look something like this. In my case I wanted to change the customer Statement File Name.

    [EventSubscriber(ObjectType::Codeunit, Codeunit::”Custom Layout Reporting”, ‘OnGenerateFileNameOnAfterAssignFileName’, ”, true, true)]

    local procedure OnGenerateFileNameOnAfterAssignFileName(var FileName: Text; ReportID: Integer; Extension: Text; DataRecRef: RecordRef)

    var

    Customer: Record Customer;

    FileNameDate: Text[20];

    dotpdfPos: Integer;

    PreFileNameLbl: Label ‘Statement for %1 %2 %3’;

    Pos: Integer;

    LengthText: Integer;

    begin

    if ReportID = 1316 then begin

    Customer.Get(DataRecRef.RecordId);

    Pos := Text.StrPos(FileName, ‘as’);

    dotpdfPos := Text.StrPos(FileName, ‘.pdf’);

    FileNameDate := Text.CopyStr(FileName, Pos, dotpdfPos);

    FileName := StrSubstNo(PreFileNameLbl, Customer.”No.”, Customer.Name, FileNameDate);

    end;

    end;

    This Returns a Filename -  “Statement for "Customer No." "Customer Name" as of "Start Date" .”

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,371 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,806 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,371

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans