Unified Operations & Dynamics AX Forum

Expand all | Collapse all

ax 2012 R3 report name / attachment file dynamically changed

  • 1.  ax 2012 R3 report name / attachment file dynamically changed

    SILVER CONTRIBUTOR
    Posted 21 days ago

    Hi developers,

    I am trying to have the name of the report, which is attached to an email as a PDF file, changed dynamically, to reflect invoice number.

    I am using SMTP to send out invoices attached to email, using print management and address tokens.

    I got the subject line to change dynamically, to include invoice name and number. Any ideas how to change the report name? 

    Would it be better to change the file name, after the report is created and placed into the temp folder from where it is picked up to be attached, 

    or, to change the report name when it is created?

    Thanks,



    ------------------------------
    Pedja Nikodijevic
    Express Scripts Canada
    Mississauga
    ------------------------------


  • 2.  RE: ax 2012 R3 report name / attachment file dynamically changed

    SILVER CONTRIBUTOR
    Posted 20 days ago
    It looks like the only way is to change the name of the attachment, through Print DestinationSettings... but there is no parameter for Attachment name, just format...

    Any ideas how to change the name of the attachment? It seems the name is coming from SRSReportDataContract, because it is defaulting to DocumentType and Report name, which in my case is FreeTextInvoice.Report. Not sure if i can change it at that point.

    Thanks..

    ------------------------------
    Pedja Nikodijevic
    Express Scripts Canada
    Mississauga
    ------------------------------



  • 3.  RE: ax 2012 R3 report name / attachment file dynamically changed

    Posted 19 days ago
    You can put the code to replace the filename in the SRSReportRunController class - runReport() method.
    Code will be something like this:
    reportContract.parmPrintSettings().fileName('YourFileName')

    This class is used for all SSRS reports. So be careful to add the code only for the report intended to run.
    Placement of the code will also depend on whether you are running the job as a batch job.

    ------------------------------
    Trupti Paralkar
    Strategic Solutions NW, LLC
    OR
    ------------------------------



  • 4.  RE: ax 2012 R3 report name / attachment file dynamically changed

    Posted 19 days ago
    This solution is for AX 2012. For 365, you will have to check if handlers are available for the method.

    ------------------------------
    Trupti Paralkar
    Strategic Solutions NW, LLC
    OR
    ------------------------------



  • 5.  RE: ax 2012 R3 report name / attachment file dynamically changed

    SILVER CONTRIBUTOR
    Posted 16 days ago
    Thanks, i have figured out the the method where you can deal only with email attachment file names  -SRSReportRunPrinter.toEmail.
    From there, you can call PrintDestinationSettings, where you would get the file name, then assign that name to an attachment.

    ------------------------------
    Pedja Nikodijevic
    Express Scripts Canada
    Mississauga
    ------------------------------