
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2018 06:21 AM
We have a situation where an external source is providing us a zip file containing other related data files. The requirement being that we then have ServiceNow unzip this file (stored as an attachment) and then store the contents (as attachments).
Is there any way from server-side script we can accomplish this?
We've spotted the GlideZipUtil, but can't figure out how to use it (or whether we can use it from script), so the best option we're currently looking at is to use a MID server script to pull the Zip file down to the file-system, unzip there and then push the contained files back all via REST.
Whilst that would work, it seems rather cumbersome and unnecessary when there may be an easier method within the platform itself.
I've had a trawl through the existing community comments, and there's really nothing of help in there (so please don't reply with the same set of external links to Stack Overflow ... we've seen them, and they're not really of much, if any help).
Cheers,
Mark
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 01:04 AM
Hi,
You could use a data source (System Import Sets>Data Sources) this has a "Zipped" checkbox which will unzip the attachment and load the data
Cheers
Dan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 01:04 AM
Hi,
You could use a data source (System Import Sets>Data Sources) this has a "Zipped" checkbox which will unzip the attachment and load the data
Cheers
Dan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2018 04:19 AM
Thanks Dan. That is eventually what we went with. Shame that there seems to be no exposure to the scripting engine of the ability to Zip/Unzip files natively as whatever way we look at it, it's somewhat of a cumbersome hack.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 01:51 PM
Great solution! The only downside to this is if there are any spaces in your zipped file names, this will fail. Trying to figure out a workaround...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 08:25 AM
This helped explain why this method of unzipping didn't work for me.
Were you successful with finding a workaround?