Adding attachments from Trigger record to a Send Email action i Flow Designer

Egil Kjørstad
Tera Contributor

I have a Scoped Application where data needs to be exported as CSV files to an external system on a monthly basis. The files should be sent via email.

All the logic for creating the CSV files is in a Script Include. I would like to create an email from the Script Include and attach the CSV files as they are produced. However, I understand that this is not the recommended approach, as it is not possible to set a SendTo parameter (right?).

In the same Script Include, I have therefore written code to generate an "Exportpackage" record where all attachments are stored. Then, I use a Flow to create an email (using the Send Email action) when the Exportpackage record is created. How can I include the attachments from the Exportpackage in the Send Email object?

There is a good chance that I'm missing some knowledge about the best way to solve this, so I'm open to hearing others' opinions on this.

EgilKj_rstad_0-1723208237049.png

 

 

Regards Egil

2 REPLIES 2

Jansilaxmi Bhan
Tera Contributor

Hello Egil,

I need help on one thing.

I have requirement to create an attachment on 1st of every month and create a request with that attachment.

I am not able to add attachment into sys_attachment table.

Could you please help me with the code for adding into attachment  to sys_attachment table?

 

Regards,

Jansi

 

Th

mjordan
Tera Contributor

I did it by doing a for each and copying attachment

mjordan_0-1733498573723.png