Question
3
Replies
640
Views
Posted: May 6, 2020
Last activity: May 8, 2020
How to send a generated csv file as an email attachment
In agent we are generating a csv file using out of the box pxConvertResultsToCSV activity and we are trying to attach the generated file in the SendEmailNotifcation activity.
But we are not able to pass the filename in the SendEmailNotification activity as it holds only the AttachmentPage as the parameter.
Any suggestions on how to attach the generated csv file to the email?
Thank you..
Hi,
You can do below approach in activity,
1. Encode the file content to Base 64 string using Java code.
2. Create a new page ExcelAttachment of type Embed-EmailAttachment.
3. Set pyName with some file name, pyDecode to true and pyData to Base 64 string for ExcelAttachment page.
4. Do a Page-Copy from ExcelAttachment to AttachmentPage.pyAttachments(<APPEND>). Now you can send this AttachmentPage as param to SendEmailNotifcation.
For testing quickly, you can get base 64 of some test file using some tools and try from step 3 before implementing step 1.