function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LogeshLogesh 

Reg: Dowloading attachments as a single zip file

Hi Friends,

 

I'm having a scenario where I need to download all the attachment for a particular custom object as a single zip file on click of a button. Here I categorize attachment based on attachment description field.

Consider there are categories such as A, B & C. Under category A, there are 5 attachments (which means these 5 attachment will have description as A) When I click on a button, I need to download all the 5 attachments belonging to A category as a single zip file. Can you guide me??

 

Thanks & Regards,

Logesh

Best Answer chosen by Admin (Salesforce Developers) 
colemabcolemab

Logesh,

 

As far as I know, you can't directly create a zip file on this platform.

 

If you want cloud based only, you will need to integrate with another platform (Amazon Web Services, an external web server, etc) to send the attachments to that platform, then zip them on that platform, and then present the download/link from that platform.

 

If you can deal with a desktop solution, I highly recommend that you check into the Java SDK for salesforce as Java has zip files built in (JAR files are really zip files).

All Answers

colemabcolemab

Logesh,

 

As far as I know, you can't directly create a zip file on this platform.

 

If you want cloud based only, you will need to integrate with another platform (Amazon Web Services, an external web server, etc) to send the attachments to that platform, then zip them on that platform, and then present the download/link from that platform.

 

If you can deal with a desktop solution, I highly recommend that you check into the Java SDK for salesforce as Java has zip files built in (JAR files are really zip files).

This was selected as the best answer
LogeshLogesh

Thanks Colemab!! Yes, as you said, there is no native library available in apex for creating zip file. (We raised a case in salesforce support and got the information). I'll try it out with the other option as you mentioned.

 

Thanks,

Logesh

Mani Cube84Mani Cube84
Hi  colemab & Logesh,

presently one of my clients is using the Amazon s3 and they are sending the images by downloading then zip and email to their customers. They want to automate the process by creating the bucket and then uploading the images there. Directly they send the URL to customers through and they download all the images in a  single shot. Can you please suggest us how to set the automation.