
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2018 10:01 AM
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.
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2018 09:13 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2020 04:24 AM
Hmm.. gotcha. Didn't think of that, let me think a bit about it and see what we can come up with.
//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor's Guide To ServiceNow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2020 05:55 AM
Yeah, I tried to add an action right after the email creation, to put the type to send-ignored and THEN do the attachment copy, but that leaves me exposed to a race condition anyway. And the SN Email API doens't let you set the type or mailbox either... I suppose one solution would be a before insert business rule on the sys_email table, which would set the type to send-ignored based on some setting, and then my Flow would update the type once the attachments are copied?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2021 06:20 AM
- Add a "Before insert" BR on sys_email, that sets the type to send-ignored if the subject starts with "[HOLD]"
- Add functionality to my workflow (ended up going back to workflow...) to send the email with "[HOLD]" at the beginning of the subject line
- Copy attachments from req item to email via a script (finding the email by its instance, which is my req item's sys_id, and the subject line starting with "[HOLD]")
- Update the attachment record to remove "[HOLD]" from the subject line and set the type to send-ready (though I suppose this step could also be a BR)
One thing I noticed is that the Notification activity in the workflow seems to be async - so I had to add a timer right after, and before my GlideSysAttachment.copy('sc_req_item', current.sys_id, 'sys_email', email.sys_id) block.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 08:27 AM
Hi Goran
Thanks for this solution, it's great!
I tried to implement it in my instance, but I'm doing something wrong and didn't work for me.
Can you help me?
I followed your steps from your video:
My action
The script section
(function execute(inputs, outputs) {
// ... code ...
var copyAtt = new GlideSysAttachment();
copyAtt.copy(inputs.sTable,inputs.sSysID,inputs.tTable,inputs.tSysID);
})(inputs, outputs);
The test result (all green / completed)
The email record in the sys_email table
Some differences between your example and my test (I think isn't the problem):
1. I used the action in a for each loop to send several emails (for each member in a group)
2. In my DEV instance the email sending it's not active
What do you think? what I'm doing wrong?
Thanks!
Ariel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 08:37 AM
Hi Goran
I created a fix script to test it and works fine, but with the action in the flow don't.
My fix script:
var sTable = 'sn_customerservice_case';
var sSysID = '8c160c70dbefe414df8e1a44059619d3';
var tTable = 'sys_email';
var tSysID = '565bfc78db236814df8e1a44059619db ';
var copyAtt = new GlideSysAttachment();
copyAtt.copy(sTable, sSysID, tTable, tSysID);
After running it the sys_email has the attachments
Thanks,
Ariel