Posted: 1 Nov 2016 21:16 EDT Last activity: 22 Nov 2016 10:50 EST
How to Attach a correspondence record to an outgoing email
We have a requirement where user can send an email using a correspondence rule and the outgoing emailwill be listed as an attachment to the case. Now the same correspondence record can be attached as .eml or .msg format to another outgoing email. Are there any way to do that ? The issue here is the the correspondence record is not stored in Data-WorkAttach table rather than it is stored in pr_data so we dont have a concrete .eml or .msg file. We have tried reading the blob from pr_data and send that as an attachment which actualy gets attached but the ontent becomes binary. Any help will be highly appreciated.
***Updated by Moderator: Vidyaranjan| Included Categories***
The OOTB SendEmailWithAttachments activity uses the base64 encoded pyAttachStream property from Attachments in order to send attachments with the email. In case of correspondence, the email is not stored as a stream. Rather, various attributes of the email are stored in different properties (for e.g. the body is stored as a text in pyBody).
Please try to find the code which is called when you try to open this correspondence from the attachment. This code should provide you some hint as to how Pega is using the Data-Corr-Email instance in order to generate the html file which pops up. We have to use the stream of the file and pass on to the SendEmailWithAttachments activity.
I dont have access to code right now and hence cannot point to anything specific.
I had to create an HTML template that has same look and feel as that of pega and i replace the From,To and caontent with the data from pr_data table. Thats an acceptable solution as of now as part of my current requirement.