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
DavidPDavidP 

Creating a zip file in Salesforce

Hi I have a question which I'm not 100% is possible in Salesforce but will welcome any suggestions / ideas. I have an APEX class which creates multiple licence keys and has dual functionality, it will either allow the user to email them as part of an email body or create the licenses as a txt file attachment to an outbound email. Now the issue is the text file needs to be enclosed within a zip file due to different mail clients unable to process the .lic extension. Is there any mechanism which will let me wrap a txt file into a zip file as part of an attachment ? Been wracking my brain for ages on this. Any assistance would be welcome even if its not possible.

HirenHiren

Did you find any solution to your problem? I am in the similar lines where I need to create zip file that will contain several xml documents. Will really appricate some insight.

Nazeer AhamedNazeer Ahamed

I have not seen any so far but it is interesting need.

HirenHiren

Yeah, we are creating an xml files from the records of several objects and then sending them to client's webserver. If there were some libraries available for compression, it would be easier to deal with the governer limits of 10 call outs per request and 3mb per call out limit.

ValnavjoValnavjo
Hiren1Hiren1

This is great! Thank you!

ValnavjoValnavjo

Hello,

 

I've created an app that will allow you to compress files in Salesforce:

http://www.valnavjo.com/blog/bzip-the-app/

You can install it from the AppExchange.

Regards,

Valnavjo

SS KarthickSS Karthick
Hi Valnavjo:
    I have seen this link and paste that code in my dev org.
http://​http://www.valnavjo.com/blog/compressing-files-in-salesforce/


But It doesnt compress the file(I mean when I click download button nothing happen).
Please help me on this.

Thanks in advance,
Karthick
Pedro I Dal ColPedro I Dal Col
You can use the Zippex library to zip or unzip files natively in Apex. It's open source.

https://github.com/pdalcol/Zippex