Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

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

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

  • Suggested answer
    shayan arshi Profile Picture
    shayan arshi 40 on at
    RE: How to get dynamic file name for PO confirmation report by using print management setup through x++ in AX 2012 ?

    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

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: How to get dynamic file name for PO confirmation report by using print management setup through x++ in AX 2012 ?

    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();

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

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

  • axk Profile Picture
    axk 925 on at
    RE: How to get dynamic file name for PO confirmation report by using print management setup through x++ in AX 2012 ?

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans