How to attach a document generated by the app to an email and send it using the Email Module

Hi, In my application I have a Document Template from which the user can currently generate and download a PDF document. I also have the Email Module working in the app. What I can't figure out is how to attach a generated document to the email.  Any help with this would be greatly appreciated. Thanks, Bryn  
2 answers

Hi Bryn, 

There are multiple ways to do this. Are you using email module with templates? If so, in your "sub_CreateAndSendEmail" microflow, you can drop a microflow after the create email activity to retrieve the generated documents and associate it to the email object.


In your microflow that sends an email, use either a retireve from database activity or a submicroflow that retrieves your documents and returns them to the parent microflow. Then call the submicroflow "Sub_createattachments" (from the email module), and pass the email object and list of documents. 


Sub_Createattachments will duplicate the list of documents that you pass to it and associate it to the email object. This will include your documents as attachments.


Hope this helps!


Bryn, you can name the PDF attachment by creating the Object (which inherits from System.FileDocument) with the attribute 'Name'.

Just type in any string.