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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get dynamic file name for PO confirmation report by using print management setup through x++ in AX 2012 ?

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a requirement to save my PO confirmation report as PDF format file name should be "PurchId-Supplier Account-supplier email address-PurchaseOrder.pdf"(00001-000) in custom destination folder file path by using print management setup. When I open the report the report should be saved automatically in PDF with custom file format. The file path should consider from print management setup.

Please help me out from this..!!!

Thanks,

Suresh M.

*This post is locked for comments

  • axk Profile Picture
    925 on at

    Hey,

    You should add your code in place where users are opening purch confirmation. To generate PDF report, you can use EPSendDocument class, which can generate and save your purch confirmation as PDF file in given destination with your file name.

    Please let us know if you need more help.

  • Suresh Marupuru Profile Picture
    on at

    Hi ,

    Thanks for your quick response.!!!

    I want to override default standard print settings where I need to pass my custom file name "PurchId-Supplier Account-supplier email address-PurchaseOrder.pdf" in srsprintmanagementsetting classes for PO confirmation report. If you have sample code snippet please post here.

    Thanks in advance.!

  • Suggested answer
    Sukrut Parab Profile Picture
    71,741 Moderator on at

    Hi try code below . I am using it for sending email with my own file. You can use it and save your file on ur destination

    SrsReportRunController          controller = new SrsReportRunController();

           HRMParameters                   parameter = HRMParameters::find();

           SRSPrintDestinationSettings     settings;

           FilePath                        outputFilePath;

           Str1260                         subject,body;

           ;

           subject = "active employee report";

           body = "your hTML body"

           // Define report and report design to use

           controller.parmReportName(ssrsReportStr(ReconReport, PrecisionDesign1));

           // Use execution mode appropriate to your situation

           //controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);

           // Suppress report dialog

           controller.parmShowDialog(false);

           controller.parmLoadFromSysLastValue(false);

           // SrsReportDataContract srsReportDataContract = controller.parmReportContract();

           //srsReportDataContract.parmisMemoryStreamOnly(true);

           //controller.parmReportContract(srsReportDataContract);

           // Change print settings as needed

           settings = controller.parmReportContract().parmPrintSettings();

           // set the print destination in contract

           settings.overridePrintContractSettings(true);

           settings.printMediumType(SRSPrintMediumType::Email);

           settings.emailAttachmentFileFormat(SRSReportFileFormat::Excel);

           settings.emailTo(email@gmail.com);

           settings.emailSubject(subject);

           settings.fileName('ReconData');

           settings.parmEMailContract().parmBody(body);

           //settings.overwriteFile(true);

           controller.parmReportContract().parmPrintSettings(settings);

           // Execute the report

           controller.startOperation();

  • Suggested answer
    shayan arshi Profile Picture
    40 on at

    You may use this blog as a solution , you just need to change the Document type enum.

     https://shayanarshi.blogspot.com/2020/01/retrieving-report-name-set-in-print.html

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Prashant Singh Profile Picture

Prashant Singh 2

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans