Sending Report as Excel Using Activity

Hi,

I am doing one poc for sending report definition data in excel format through activity.

  1. Call pxCallRetrieveReportData {for calling report in activity}

  2. Call pxGenerateExcelFile ExceStepage {for generating excel}

  3. Page-New AttachmentsPG {Steppage [class = Data-EmailAttachments ] }

  4. Page-Copy AttachmentsPG {Stepage}

CopyFrom = ExceStepage

CopyInto = .pyAttachments()

  1. Call sendemailnotification.

I am receiving only email message, not receiving attachment in the form of excel.

Can anyone help me with any solution, or what mistake I am doing here?

@AbhishekC1725 Please use OOTB option for the scheduled report option. Go to report browser and select the report and click edit option and configure the schedule option. you will get the report definition as a excel attachment via email.

@Nadimuthu T I know this. But here the requirement is different.

@AbhishekC1725 you can refer to sendemailwithattachments OOTB activity.

@AbhishekC1725 Please follow below mentioned steps.

Property-Set

AttachmentPage.pyAttachments().pyName = Attachment Name

AttachmentPage.pyAttachments().pyData = Attachment Stream 64 byte

AttachmentPage.pyAttachments()..pyDecode = true

Call sendEmailNotificationWithAttachments or SendEmailNotification baseclass activity and pass Param.AttachmentPage =AttachmentPage and other required parameters.

@Nadimuthu T AttachmentPage.pyAttachments().pyData = Attachment Stream 64 byte

Can you explain this step.

​​​​​​​Currently the excel file is in Page = ExceStepage

@Anoop Krishna will check this also

@Nadimuthu T pxGenerateExcelFile activity generate the excel file and place into service export directory. Please refer pyActionSendMail activity step 14 and get the file and Local.strFileData holds the attachment stream data.

@Nadimuthu T Thanks for explanation.

@AbhishekC1725 If you have achieved this, please post the screenshots of the same. Will be helpful for the others. Also wanted to confirm one thing, you are trying to generate an excel and directly send that over email right? That file is not attached to case right?

@Anoop Krishna Yes, The file is not attached to the case. I am generating excel using Call pxGenerateExcelFile method.

Job scheduler in Pega: Generate Excel and as an attachment in email, tracing job scheduler - YouTube

This video will be help full for you. Java code is present in the description of this Video.

Sorry I can;t share activity screenshot here, due to privacy policy.

Pages & Classes {That are used}

Atts[Pagename] Data-EmailAttachments {Class}

Att[Pagename] Embed-EmailAttachment {Class}

Major Steps In activity {I used}

  1. Call pxRetrieveReportData

  2. Call pxGenerateExcelFile

  3. Property-Set

  4. Java

  5. Page-New Att

  6. Property-Set Att

  7. Page-New Atts

  8. Page-Copy

From = Att

CopyInto = Atts.pyAttachments(1)

  1. Call SendEmailNotification

  2. Page-Remove

Hope this will helpfull