How to unzip file from sys_attachment table and store it back?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 01:31 AM
Hi everybody,
I looking for way to unzip specific file,
from zipped file in sys_attachment table and add new txt file to sys_attachment table back?
Zip file contains directories and txt files. We need to get specific file from it.
How we can do it?
Regards,
Andre.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2019 09:01 PM
Hi Andre,
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
Otherwise, Refer to these Links :
https://stackoverflow.com/questions/2095697/unzipping-files
https://stackoverflow.com/questions/34439147/how-to-unzip-file-on-javascript?rq=1
If my reply helps you at all, I’d really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons..:)
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2019 01:17 AM
Hello Jyoti,
We need solution for back end. Getting zip (file) from sys_attachment and extract one file from it`s content.
We attach zip file to CR and than we want to trigger extraction from zip file.
Possible solution is to use GlideZipUtil. But there is no documentation for this.
Regarding Data Sources, we don`t use it. We attach zip file to CR and than we want to unzip it.
Regarding your links,
1. for this solution you need use util package, but (from what i understand) service now removed/blocked use of packages.
2. General limitation for this solution is that it not supported for all browser like Internet Explore:
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API
Regards,
Andre.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 04:05 PM
Check if this is helpful: https://community.servicenow.com/community?id=community_article&sys_id=4d2653c41b52cc10fff162c4bd4bc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 12:12 AM
Hi Andre,
Is it implemented?. Could you please share the solution. I have the similar requirement to achieve. It will help. Thank you