The CreatorCon Call for Content is officially open! Get started here.

Error: Empty Attachment Record when trying to copy attachment using Flow Designer

tiagobrito
Giga Contributor

Hi Everyone!

 

I created a Subflow (triggered by a UI Action) to transfer an SC Task to an HR Case. As part of this requirement, I want to copy the attachments too and I'm trying to use the existing actions: "Look Up Attachment" and then "Copy Attachment" but I get the following error: Error: Empty Attachment Record. (sys_script_include.5430bdf89313130079b5925cf67ffb04.script; line 23)

 

I can even see the attachment record on the Flow Execution Details but for some reason isn't working - any thoughts?

 

Screenshot 2023-04-21 at 18.44.42.png

Screenshot 2023-04-21 at 18.45.57.png

4 REPLIES 4

Craig Lawson
Tera Contributor

Hi @tiagobrito,

 

Did you ever find a fix for this? I'm having a similar issue but going from RITM to an email.

I had the same issue and found the solution here:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0813220

 

Essentially, once you look up attachment - then you have to look up record on the sys_attachment table and use the condition sys_id = the sysid you found in lookup attachment.  Then you can do a copy attachment and use the record you found...a few extra steps.

 

This should help:

Screenshot 2023-08-15 at 5.26.57 PM.png

 

So:

Lookup Attachment (use your source record that has the attachment on in it)

Lookup Record (find the record with that attachment sys id on the sys_attachment table)

Copy Attachment (use the record you found in Lookup Record)

 

Hope that helps!

Hi All,

           I just want to know here because the timestamping of the mentions here are relatively recent.   Do you mind stating what release you all are using when this occurred?   I ask because I'm going through upgrade testing & after grading to a newer release; the "Copy Attachment" action is not working when it did before.  We didn't have to do the "Look Up Attachment Record" action you've mentioned above.   Our scenario was the same as Craig Lawson stated; which is sending an email from a RITM. 

This does invite the question.... what's the point of that action at all?

I just eliminated step 2 in your screenshot altogether and adjusted step 3 to look for the sys_id of the source record as the "Table sys ID" value.  Now I found all attachments linked to the source record, where the original action is limited to 1.

So not only am I now not limited to a single result using this method, I also don't need to worry about handling an error condition if the source record has zero attachments, since I'm just looping the Copy Attachment action through the total number of records found.  If total is zero, then it won't try to copy an attachment.

After trying to use it, I'm now struggling to understand the purpose of the "look up attachment" action at all.

 

Ben131_1-1696435803757.png