Question

Send Email with attachment excel

I have Requirement to copy the data of pagelist into Excel and copy each property into Excel file as a column. Then add that excel file as attachment into email and Send that email to multiple users.

Is there any OOTB to copy the data from pagelist into excel and attach excel file to email?

How to achieve this?

***Moderator Edit-Vidyaranjan: Updated Platform Capability***

Correct Answer
November 26, 2019 - 7:12am

Thanks Bhavya for your reply. I used existing send report email functionality logic in pega and it is working now.

Comments

Keep up to date on this post and subscribe to comments

November 11, 2019 - 12:17pm

Hi

You can use "MSOGenerateExcel" activity to generate the excel and then use SendEmailWithAttachments activity.

 

Regards

Bhavya

November 14, 2019 - 3:45am

Thanks for your reply. Now it generates excel file but how to add that excel as attachment to email. Because in SendEmailWithAttachment it is asking for attachment. So how to add that excel as attachment?

November 14, 2019 - 4:13am
Response to DarshanaD

Hi

Can you try with below steps:

1. Create a new page "AttachmentPage" of class "Data-EmailAttachments".

2. Set the below properties on "AttachmentPage"
AttachmentPage.pyAttachments(1).pyName (Name of your to be attached)
AttachmentPage.pyAttachments(1).pyType (File extention)
AttachmentPage.pyAttachments(1).pyDecode to "True"
AttachmentPage.pyAttachments(1).pyData (Set your base64 encoded stream here)
3. Pass this page as parameter to AttachmentPage.(Check the exact parameter name in the activity)

Regards

Bhavya

November 14, 2019 - 4:48am

Hi Bhavya,

Thanks for quick response.

I have fetched all records from database based on filter condition using Report definition. I got all results on RequestPage.pxResults. I added this page as as step page while calling MSOGeneratedExcelFile activity and select download file checkbox. It download the excel and fetch the correct details in file. Now I need to add this excel file as attachment to email. Where is the file location.Can you please describe the above step briefly and exactly what parameter we need to pass to attach that file? 

November 18, 2019 - 12:47am

Hi

Try below steps:

1. Uncheck the download option.

2. Copy the excel content from the page to the AttachmentPage. And use that as parameter to "ReferencePage" param. 

 

Regards

Bhavya

November 26, 2019 - 7:12am

Thanks Bhavya for your reply. I used existing send report email functionality logic in pega and it is working now.

Mod
November 26, 2019 - 9:07am
Response to DarshanaD

Thank you for updating the resolution! We have marked this post as Answered.

Lochana | Community Moderator | Pegasystems Inc.