Using Flow Designer, add attachment to Send Email Action

Daniel O_Connor
Kilo Guru

Hi all,

I've created a Custom App using Studio, whereby we will receive Weather Warnings from a National Weather provider, and then forward this e-mail onto relevant parties. 

I created an extension of TASK so we can have a record of these weather alerts. The e-mail that we will receive, will contain a PDF attachment, that is the details of the warning.

Through my inbound action, I'm creating a record on my new table, where the PDF will be attached to the ticket.

Through Flow (new module, not legacy workflow) I've been able to spin my flow up pretty quickly. However I see no option to include the attachment from the record, onto the e-mail I'm sending out.

find_real_file.png

Any ideas how I can accomplish this?

  • With Send Email action in Flow Designer, have the attachment from the record included in the generated email 
1 ACCEPTED SOLUTION

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Daniel,

 

Bad news is that I don't think there is a OOB functionality for this. Good news are that it's very easy to solve with a custom action. Basically you create you own "copy attachment" action and then you can use that action to copy the attachment from the task record to the email-record that is used to send the email.

 

I made a quick video here for you to see what I'm talking about:

View solution in original post

27 REPLIES 27

Hi Goran

Another test. I tested the action and works

find_real_file.png

 

find_real_file.png

The problem is when I used in the flow. Any suggestions?

Thanks,

Ariel

Hi Goran!

Works! Your solution's great!

I changed the "email" for "email.sys_id". I'm not 100% sure this was the error but works now!

 

find_real_file.png

 

Thanks!

Ariel

 

Hey Goran. I gave this a try, and there seems to be some kind of race condition in the mix. My trigger on my flow is a Service Catalog trigger. I'm using the default "run flow in background" setting. When the email arrives, the attachments are not on the email. If I manually test the flow using the same RITM record that triggered the flow the first time, the second email does have the attachments. I noticed in your video that you mentioned that the "Send Email" action "queues" an email, and that your attachment copy action runs right after that action. Is it possible that the email is queued and sent by the system in the background before the attachments can be copied?

Adam G1
Kilo Contributor

I used a method similar to Benjamin Nuttin's suggestion to solve this race condition.

I got this to work however when anything besides image files are attached, it does not send an attachment. 

PDF, docx. etc