I have created a content pack of our Quotation Template Documents that I want users to be able to download from within the Quote Page Layout, preferably by a button. I have done some very limited VF coding, but not sure how to do this one - I am sure it's fairly simple, can anyone assist?

1 Answer 1


This may be help you.

visualForce code:-

       <apex:page standardController="Case" extensions="AllAttachmentsController">
    <h1>Link Farm: </h1>

    <apex:repeat value="{!attLinks}" var="ad">
        <li><a href="{!ad}">CLICK ME</a></li>


 public class AllAttachmentsController
  public List<Attachment> ATT {get;set;}
  public AllAttachmentsController (ApexPages.StandardController stdController) { }
  public List<String> getAttLinks() {
   Id caseid = ApexPages.currentPage().getParameters().get('Id');
    List<String> attLinks = new List<String>();
    String strURL;
    String strResult ;
   ATT=[SELECT Id, Name FROM Attachment WHERE parentId = :ApexPages.currentPage().getParameters().get('Id')];
   integer j = ATT.size();for(integer i=0; i<j; i++) {
  strURL= 'https://' + ApexPages.currentPage().getHeaders().get('Host')+ '/servlet/servlet.FileDownload?file='  + ATT[i].Id;
 } return attLinks ;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.