Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

PDF attached to case but missing in email attachment by category

SA-91279

Summary



On click of a button to generate a PDF and sending it to the required mail ID, the generated PDF is attached to the work object. However, it is missing as an attachment in the email that is sent.
On clicking the button the second time, a new PDF is generated and attached to the work object along with the earlier PDF. However, only the first PDF is sent as an attachment.
This occurs on every click of the button and n-1 PDFs are sent in the mail as an attachment (where n is the number of PDFs generated and attached to the work object).



Error Messages

Not Applicable


Steps to Reproduce

  1. Create an activity.
  2. Invoke the pyAttachAsPDF in Step 1 of the activity to generate and attach the PDF to the work object.
  3. Invoke the SendSimpleEmail in Step 2 of the activity to send the attached PDF to the required mail ID.
  4. Configure a button in the case.
  5. Invoke the activity on the click of the button.
  6. Execute the case.
  7. Click the button. The PDF is attached to the work object. However, the PDF is not sent in the mail as an attachment.
  8. Reclick the button. The new PDF is attached to the work object along with the older PDF. However, only the first PDF is sent as an attachment.

Root Cause



On the third step of the pyAttachAsPDF activity, Code-Pega-PDF.AttachToWork is invoked to attach the PDF to a work object. After attaching the PDF to the work object, the pyAttachment page list is flushed. The pyAttachment property refers to the D_AttachmentList data page which contains all the attachments of the current work object. 
Since pyAttachment is flushed, the current attachment is not present before the SendSimpleEmail is invoked. Hence, the pyAttachment must be reloaded to fetch all the attachments of the current work object.



Resolution



Perform the following local-change: 

Add the step as below @SizeOfPropertyList(.pyAttachments) after Call pyAttachAsPdf and before Call SendSimpleEmail to reload the pyAttachment to fetch and store the PDF generated currently.


Published February 15, 2020 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us