send a report as attachement in an email

hello, I also asked this question on the technical forum, but unsuccesfully untill now. I am trying to create a job where I can run a report, save it into a temporary file so I can email it as an attachement to a particular email address. (without interference of a user) I don’t seem to find out how I can create a temporary file from my report. static void myJob(Args _args) { Args aa = new Args("myReport"); ReportRun rn = new ReportRun(aa); SysINetMail m = new SysINetMail(); PrintJobSettings p1 = new PrintJobSettings(); str fileName; ;; // code to catch my report and save it in to a temporary file, //which I can send through the filename fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-999)+'PDF'; m.sendMailAttach(p1.mailTo(),p1.mailCc(), p1.mailSubject(),'Axapta report', FALSE, p1.fileName(), fileName); } Suggestions? thx, Kathleen

I think I am getting closer, but just not there yet. static void myJob(){ rn.printJobSettings().setTarget(PrintMedium::FILE); rn.printJobSettings().preferredFileFormat(PrintFormat::PDF); rn.printJobSettings().fileName(strfmt("%1\%2", WinAPI::getTempPath(), "myTempFile.PDF")); rn.printJobSettings().paperOrientation(PrinterOrientation::Landscape); rn.printJobSettings(rn.printJobSettings().packPrintJobSettings()); info(rn.printJobSettings().fileName()); rn.printJobSettings().mailTo(""); rn.printJobSettings().mailSubject("Artikelcreatie tijdens de voorbije week");; fileName = rn.printJobSetttings().fileName(); m.sendMailAttach("","","test me",'Axapta report',FALSE,rn.printJobSettings().fileName(),fileName); } I don’t get the myFile.PDF printed yet??? thx, Kathleen

found out the code statement isn’t readable Next try : rn.printJobSettings().setTarget(PrintMedium::FILE); rn.printJobSettings().preferredFileFormat(PrintFormat::PDF); rn.printJobSettings().fileName(strfmt("%1%2", WinAPI::getTempPath(), “myTempFile.PDF”)); rn.printJobSettings().paperOrientation(PrinterOrientation::Landscape); rn.printJobSettings(rn.printJobSettings().packPrintJobSettings()); info(rn.printJobSettings().fileName()); rn.printJobSettings().mailTo(“”); rn.printJobSettings().mailSubject(“Artikelcreatie tijdens de voorbije week”);; fileName = subStr(rn.printJobSettings().fileName(),strlen(rn.printJobSettings().fileName()),-999); m.sendMailAttach(“”,"",“test me”,‘Axapta report’,FALSE,rn.printJobSettings().fileName(),fileName);

To all of you out there you need to how how it is done : Args aa = new Args(“myReportName”); ReportRun rn = new ReportRun(aa); ; rn.printJobSettings().setTarget(PrintMedium::Mail); rn.printJobSettings().Format(PrintFormat::PDF); rn.printJobSettings().mailTo(“theUsersEmailAddress”); rn.printJobSettings().mailSubject(“SubjectTitle”);; Kathleen

Hi guys,

if someone , can tel me how change the name of report as email attcahement, i have for example as name of file attachement , i want to rename it in onther name .

Thank You for helping