- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 04:14 PM
I was wondering if there was any way to download multiple files from multiple records in a single zip file.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 09:22 PM
Hello,
Please use below link to get an idea of how to setup. It uses JAVA packages and Processor. Use can customize that in processor script based on relationship between the records to find correct attachments to ZIP
https://www.servicenowguru.com/scripting/download-attachments-zip-file/
Note: Please mark reply as correct if it answers your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 08:54 PM
Not that I'm aware of. You can download all the files for a single record using `download_all_attachments.do?sys_id={SYSID OF TASK}`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2018 07:29 AM
I was hoping to get something for multiple records at the same time, and not necessarily on any task tables.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 09:18 PM
Hi,
Hope below code will help you:
You can use the ZipArchive
class to create a ZIP file and stream it to the client. Something like:
$files = array('readme.txt', 'test.html', 'image.gif');
$zipname = 'file.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);
foreach ($files as $file) {
$zip->addFile($file);
}
$zip->close();
and to stream it:
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipname);
header('Content-Length: ' . filesize($zipname));
readfile($zipname);
https://www.servicenowguru.com/scripting/download-attachments-zip-file/#comment-34336
NOTE: Mark correct or helpful if it helps you.
Warm Regards,
Raj patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 09:22 PM
Hello,
Please use below link to get an idea of how to setup. It uses JAVA packages and Processor. Use can customize that in processor script based on relationship between the records to find correct attachments to ZIP
https://www.servicenowguru.com/scripting/download-attachments-zip-file/
Note: Please mark reply as correct if it answers your question.