Hello, I am in need of automating reports to print to PDF and then attaching it to an email and then sending it to a known address. This includes POs and Invoices. I can send text emails and attachments located on a drive in Windows, but how can I automate the report running and then the attaching of it to an email? I’m also not sure if I need to automate the report, save the PDF to a drive in Windows then email the attachment, then (if no errors) delete the file. Does anyone have any sample code to look at or a class that may help?
Hi Melonas, if you want to send a report to a target, you can use this: element.printJobSettings().setTarget(PrintMedium::Mail); You can change the Mail → file to print to the file. Regards,
Thank you Khue. That works ok for one of our tasks. The other task is an automated email. One with no user intervention. I believe I will have to save as a file and then call the email function passing the file name. I used: _fileName=‘Y:\AxaptaEmails\’+VendPurchOrderJour.PurchId+’.pdf’; element.printJobSettings().setTarget(PrintMedium::File); element.printJobSettings().fileName(_fileName); element.printJobSettings().format(PrintFormat::PDF);
There are several ways to send email with attachment by Axapta. I believe you can find the code in this forum by using search funtion. If you can not find the code you need. then please let me know. regards,