Auto Download returned ResponseBody
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 08:20 PM
Currently I have developed one way integration between ServiceNow & Amazon Web Services (AWS) S3 bucket. The objective is to download file from AWS using RESTMessageV2. I know there is a existing method in REST message to save the returned ResponseBody as an attachment record, which is saveResponseBodyAsAttachment(). But the problem is I dont want to save the file into SN attachment table. Instead, I want to auto download ResponseBody to local disk (without saving in attachment table). I there any way to do this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 08:28 PM
I think directly interacting with a user's local file system from a server-side script in ServiceNow, such as downloading files directly to a local disk, is outside the scope of ServiceNow. Scripts running on the ServiceNow platform cannot directly access or modify client-side resources, like the file system of a user's computer.
Can you help me with the reasons why you need this so that I can think of workarounds?
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 08:41 PM - edited ‎03-18-2024 08:42 PM
Hi @Amit Pandey
Reason is we dont want to keep any files in attachment table for downloaded files from AWS S3 due to limited storage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 09:34 PM
You can consider temporarily storing the file's content in a script variable or in a temporary custom table designed to hold the file temporarily. However, remember that storing large amounts of data temporarily in the database can have performance implications.
There's no way you can bypass user intervention. Ideally, you should insert the attachment and then, user should download it manually then delete the attachment. This method involves the user in the download process but allows you to bypass storing the file in the ServiceNow attachments table. You can refer to my answer here-
Please mark my answer helpful and correct.
Regards,
Amit