Hej!
Is there any known way to maybe convert a already made Report File (.rpx) to HTML, so we can use it as notification template? Our Customer would like to send E-Mails with their Design but without having the main report attached, instead letting the E-Mail itself being the “Report”.
Help would be appreciated!
Thanks
Convert Reports to Notification Template
Best answer by Hughes Beausejour
Report definition file (RPX) can’t be converted to HTML or to Notification Template because the formats are incompatible. However the reports render it’s output in HTML by default.
So you can follow instructions on how to render report file:
https://asiablog.acumatica.com/2017/05/get-pdf-file-from-report-using-code.html
And specify the HTML output option:
byte[] data = PX.Reports.Mail.Message.GenerateReport(reportNode, ReportProcessor.FilterHtml).First();
To include the report in a email along with a template you need to send the email template programmatically:
https://asiablog.acumatica.com/2017/05/sending-notification-template-from.html
And add the report HTML output to the body of the email:
TemplateNotificationGenerator sender = TemplateNotificationGenerator.Create(order, notification.NotificationID.Value);
sender.MailAccountId = (notification.NFrom.HasValue) ? notification.NFrom.Value : PX.Data.EP.MailAccountManager.DefaultMailAccountID;
sender.RefNoteID = order.NoteID;
sender.Owner = order.OwnerID;
sender.To = contact.Email;
sender.Body = sender.Body + [... HTML Report Output ...];
sent |= sender.Send().Any();
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.