Save a file from URL link as attachment to ServiceNow - Flow Designer

SNNoob
Tera Expert

Hello!

I have a Flow Designer Action where there is a GET request to a third party application and the response is a URL link to a CSV file (link that if I were to copy-paste it to my browser and hit enter, it would download the CSV file to my own computer).

Is there a way in ServiceNow to get the file behind the link that comes with the response body and save that as an attachment to a particular record? I have tried the "Save as attachment" in the REST step Action but it only saves the response (i.e. the URL itself, not the file).

Any help or ideas would be very much appreciated!

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @SNNoob 

for saving a file provided by a URL you have to initiate another REST message call. That way, you also can use the REST step in Flow Designer.

Or for a scripted approach have a look at the following API method: https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server/sn_ws-namespace/c_RESTMessag...

Kind regards
Maik

View solution in original post

4 REPLIES 4

Maik Skoddow
Tera Patron
Tera Patron

Hi @SNNoob 

for saving a file provided by a URL you have to initiate another REST message call. That way, you also can use the REST step in Flow Designer.

Or for a scripted approach have a look at the following API method: https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server/sn_ws-namespace/c_RESTMessag...

Kind regards
Maik

Thanks @Maik Skoddow 

All that was needed was indeed an another REST call to the URL that comes with the first REST Response. All little bit of regex to remove double quotes in between and now it works wonderfully.

Thanks again!

Thanks for the feedback and glad to help!

could you please suggest me , i have an url field which contains url of the downloadable file and almost 700 records are there so how i can automate that to attach the file in every records