Comments on: Download Attachments as a ZIP File https://servicenowguru.com/scripting/download-attachments-zip-file/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:27:38 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: MadanKumar Nachukuru https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6948 Wed, 04 Oct 2017 06:34:18 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6948 “Save all attachments” button does not download all the attachments

1. If you select the “Save All Attachments” ui action and unzip the folder, only 2 out of the 6 *.nmf files have downloaded. Four of them have not as they are 0KB. I have done this over 5 times, closing and opening my Chrome browser and it is reproducible each time.
2. However, if you select to download them all one by one – its successful.

]]>
By: MadanKumar Nachukuru https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6947 Tue, 03 Oct 2017 09:57:54 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6947 In reply to Laurentiu Latu.

Did you got solution for this
Code works, but sometimes I get the attachment.zip containing the actual attachment file empty. 0 bytes.
Debugging this, at the line var binData = sa.getBytes(gr), binData.length = 0, even if the download of the file directly from the interface works. How can I find what is wrong ?
am also facing same issue

]]>
By: Georgi https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6946 Tue, 03 Oct 2017 07:06:01 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6946 Hello All,

I am using Export Sets on my DEV instance (Jakarta) in order to export table records as csv files to a specific folder of my MID Server, installed on Windows Server. I am currently struggling to find out if it is possible to export the attached to these records jpg or pdf files. As I know, Export Sets do not export attachments to records. Thus, I am looking for an additional mechanism which to combine with the Export Sets.

Reading this thread, I may say that it sounds really useful! Great Job for posting it!

Here now, I wonder – does anyone of you have any thoughts how the mechanism shared here can be modified to run automatically and cover my scenario? Is there an existing solution at all via which I can export the attached jpg & pdf files to the table records which I am exporting from SNOW as csv files via Export Sets?

I will highly appreciate if you may give me a hand! Thank you!

]]>
By: Deepak https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6945 Tue, 19 Sep 2017 05:05:59 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6945 Hi

The getBytes method fails for reading PDF content.

Any alternate for downloading pdf content.

Thanks
Deepak

]]>
By: Ben Collyer https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6942 Wed, 17 May 2017 03:23:45 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6942 Regarding attachments >5mb look at my answer on this Community post: https://community.servicenow.com/message/1111625#1111625

]]>
By: Nitin Shukl https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6941 Fri, 28 Oct 2016 12:53:47 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6941 Jacob,

We are facing issues with more than 5 MB filesize. It works fine for filesize less than 5 mb.

If one of the attachment is more than 5 mb, then it creates the zip but the file in zip will be 0 kb. But other files with less than 5 mb will appear just fine.

]]>
By: Mark Stanger https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6940 Tue, 04 Oct 2016 20:37:53 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6940 In reply to Jace.

Take a close look at your UI action code and make sure it matches what I’ve got above. There is an ampersand that was encoded incorrectly that may be causing your issue.

]]>
By: Jace https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6939 Tue, 04 Oct 2016 18:19:06 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6939 In reply to Jacob Andersen.

I am trying to get this to work in Helsinkie but It seems that is where this is now failing;

var sysattachment = “new Packages.com.glide.ui.SysAttachment();”;
var zip = “new Packages.java.util.zip.ZipOutputStream();”;

function getNewMethod(script){
var gcsf = GlideCustomerScriptFixer(script);
gcsf.processScript();
gcsf.convertedScript.toString();
return gcsf.convertedScript;
}
gs.print(‘Attachment: ‘ + getNewMethod(sysattachment));
gs.print(‘zip: ‘ + getNewMethod(zip));
//10:14:40.274: Attachment: new GlideSysAttachment();
//10:14:40.275: zip: new Packages.java.util.zip.ZipOutputStream();

]]>
By: Laurentiu Latu https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6938 Wed, 05 Aug 2015 12:54:59 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6938 Update: This is not happening depending on the file. If a file can be downloaded in the archive, it will always work. If a file couldn’t be downloaded, it never will. So it has to be something with the file ?

]]>
By: Laurentiu Latu https://servicenowguru.com/scripting/download-attachments-zip-file/#comment-6937 Wed, 05 Aug 2015 12:29:05 +0000 https://servicenowguru.wpengine.com/?p=1595#comment-6937 Code works, but sometimes I get the attachment.zip containing the actual attachment file empty. 0 bytes.
Debugging this, at the line var binData = sa.getBytes(gr), binData.length = 0, even if the download of the file directly from the interface works. How can I find what is wrong ?

]]>