File/attachment name dynamically changed

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,

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?

Thanks

Does AX 2012 contain SRSPrintDestinationSettings.fileName() as AX7 does?

Yes, it does. That was my first try…

But i believe that fileName() is only working when you save the Report as a file. when it goes through email, as in my case, it doesnt consider that fileName() value… when it gets to ReportRun.printToEmail, then its dealing with attachmentName and attachmentPath…

SRSPrintDestinationSettings is the right place to set/get the attachment name. the fileName() method can be modified and used to dynamically assign the name, but it is maybe better to create the separate method, where you would deal only with attachments.

Then, the method can be called from SRSReportRunPrinter.toEmail, to assign the new name for the attached file.