Server-side script to bulk download attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 07:43 AM
I need to create a script (either a REST API or a server-based script) or UI Action that will download all attachments for a given custom table. There are approx 5000 entries. So manually having a user click each one and save is out of the question. Also, the customer does not have a MID server, sending XML to MID and save on shared folder is out unfortunately.
I have searched the community and everything points back to an old (6 years) article:
https://servicenowguru.com/scripting/download-attachments-zip-file/
This didn't work for me. I get an error on the below line which states that getOutputStream is undefined.
var out = new Packages.java.util.zip.ZipOutputStream(g_response.getOutputStream());
I have also looked at Attachment API but don't see how it gets me what I need.
Looking for assistance or alternatives. Somewhat urgent.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 07:47 AM
HI
Here is what you have to do : https://servicenowguru.com/scripting/download-attachments-zip-file/
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 08:24 AM
Sandeep as per my above comment I already saw that link and ran into an issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2022 07:24 AM
10 years old solution. Does not work any more
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2023 08:47 PM
Hi @Mike 3ra , Did you find a solution to the above issues?
Thank you