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 :
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

I have the same question (0)
  • 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,710 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

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans