3

Are you ok using an AppExchange app to address your requirements? if yes, then there's a paid app available on AppExchange Mass File Download, its perfect solution to mass-download files/attachments related to a record or multiple records in just 1-2 clicks. Check out app @ https://sforce.co/34thF8U (AppExchange URL)


2

I made a "Content Document" so I could then create a public link and use it in the front: public class PX_IRN_PDF_CTR { @AuraEnabled public static String generaPDF( Id accId1){ String url = '/apex/PX_IRN_PAGE?id=' + accId1; PageReference pageRef = new PageReference(url); Blob ret = pageRef.getContentAsPDF(); String ...


1

A single File (ContentDocument) can have many Versions (ContentDocumentVersion) which all link to the same record (ContentDocumentLink). Your code is pulling all the versions for the record which will include current and old versions. The easiest fix is to include isLatest to only pull the latest version of files. List<ContentVersion> versions = [...


1

You have a single imageURL, and its not part of the list of attachments try <apex:image url="{!'/servlet/servlet.FileDownload?file=' + atch.attachobj.Id}" style="max-width:100px;max-height:100px;"></apex:image> and get rid of the imageURL declaration and also imageURL='/servlet/servlet.FileDownload?file='; if(relatedAttachments.size()>0) ...


1

Your imageURL property is the same for all the records. You have to do the following: a) Update your custom class to have the imageURL in public class selectedAttachments { public Attachment attachobj{get; set;} public Boolean Selected {get;set;} public String at_size {get; set;} public DateTime at_createDate {get; set;} public String ...


1

The "incomprehensible junk" is the actual binary content of the file. The URL that you receive in ContentVersion's Body field is an sObject Blob Retrieve endpoint. From that documentation: Because blob fields contain binary data, you can't use JSON or XML to retrieve this data. There's no need to perform Base64 decoding because you are directly ...


Only top voted, non community-wiki answers of a minimum length are eligible