Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Retrieve "File Name" for lookup attachment action

orlando3
Tera Expert

Hello all,

 

I am working on copying attachments to JIRA, the issue i am facing is that i do not know how to get the file name of the attachment for the current record., since there is no data pill option, i assume this would need to be scripted?

1 REPLY 1

Laszlo Balla
ServiceNow Employee
ServiceNow Employee

Hi there,

 

Are you sure you need the file name? If there is 1 attachment, this action will work without a file name just one fine, otherwise it will return the 1st one it finds.

I have actually done something similar recently for a different application using a custom spoke, and since I could not be sure that there will always just be one attachment (even if that is the expectation) I have decided to use a 'Look Up Records' action on the attachment table and then triggered the file transfer (Copy Attachment in your case) inside a 'for each' loop. This is how it looks like:

LaszloBalla_0-1673548974959.png

 

Maybe this could also work for you?