+ Start a Discussion
Roger WickiRoger Wicki 

File Download Group

Dear community

I am in the need to bundle attachments which are saved to a custom object throughout the week and on weekends make them available for download as an archive file. I intended to create a zip containing the documents but found out Salesforce does not allow creation of zips. So instead I have to look for something that will somehow group those files e.g. in a documents folder (even if I then have duplicate files in SF) and make them available for bunch download. The zipping can still be done after downloading in the end by the user but I do not want the user to have to open every file and download it separately. Any ideas?

Best
Roger
Best Answer chosen by Roger Wicki
Roger WickiRoger Wicki
Hi Ashish

Yes I slowly begin to think in that approach as well. I could still zip them that way before downloading. I might use an approach where during the weekly processing I generate a list of IDs, upload them somewhere (Static Resource, Custom Object, Custom Setting) and send out a link via email to the people who need to have access to those files. Then upon click I could use a combination of VF and Apex to optionally zip and finally download the files. I think a custom object might be the best approach.
The weekly process creates a file containing information gathered from the attachment's parent records so I think a custom object approach would be a good idea. I could then immediately save that file as well as the link to the attachment download in a record. Pity we can't create master-detail relationships with attachments. Would be way better to also have the ability to show the related attachments on that custom object record.

Thanks for your input! ;)

All Answers

Ashish DevAshish Dev
At the time of download zip all the file through jszip javascript libarary and then download that.
Here is good article http://www.valnavjo.com/blog/compressing-files-in-salesforce/
Roger WickiRoger Wicki
Hi Ashish

I was already aware of this article. Do you think it is doable without any screens or user interaction? I really like this to be done automatically as a background process weekly...
Ashish DevAshish Dev
Roger,
I can suggest you one thing, On click of target link, open all the download links in background through javascript, hence all the files will be downloaded on one click.
Roger WickiRoger Wicki
Hi Ashish

Yes I slowly begin to think in that approach as well. I could still zip them that way before downloading. I might use an approach where during the weekly processing I generate a list of IDs, upload them somewhere (Static Resource, Custom Object, Custom Setting) and send out a link via email to the people who need to have access to those files. Then upon click I could use a combination of VF and Apex to optionally zip and finally download the files. I think a custom object might be the best approach.
The weekly process creates a file containing information gathered from the attachment's parent records so I think a custom object approach would be a good idea. I could then immediately save that file as well as the link to the attachment download in a record. Pity we can't create master-detail relationships with attachments. Would be way better to also have the ability to show the related attachments on that custom object record.

Thanks for your input! ;)
This was selected as the best answer
Roger WickiRoger Wicki
I did it as described above. If somebody needs example material you can contact me.