Skip to main content

The user needs to be able to view a PDF file attachment.  Is there any way to do this in a popup or a link?

You can put a url in your skuid page that calls the salesforce mechanism for showing PDFs and other attachments.


In tables of attachments, I put the following code in a template field instead of showing the Name field:


<A Href = “/servlet/servlet.FileDownload?file={{{Id}}}”; Target = “_Blank”> {{Name}}


What this does is post the text of the Attachment Name, but the hyperlink actually opens the PDF in another tab or window. You do have to make sure that your Attachment ID and Name are in your model.


If you want to go the popup route, you can use that same href, but in an iframe. Add a popup to your Skuid page layout (from a Page Title button or a Table Global/Row Action, for instance), and drop a template component in with something like the following:


<iframe src="/servlet/servlet.FileDownload?file={{{Id}}}" style="width:100%; min-height:650px;"></iframe> 

Adjust the min-height property to get it just the way you want it.


J - 
This worked perfectly!  Nice solution!  Thanks so much!


Thanks for this info - very helpful.


Sure thing! Glad it helped. Thanks for being a part of our community!


So what this does is that it brings up this other page:


then you click on view file to view it.


Is that the way its supposed to work?

I was expecting it go right away into view mode. Is there a way to do this and bypass this intermediate page?


Thanks.


Can you post your method? The page you are showing is what you get when you click the “Name” field on the attachment. If you add a Template field (be sure to click enable HTML on it) with the code above, it will download the Id of the attachment but display to the user a clickable hyperlink with the Name text.


<A Href = “/servlet/servlet.FileDownload?file={{{Id}}}”; Target = “_Blank”> {{Name}}


Make sure you have the Id field selected in your attachment model


Chandra, Here is what I have:


Thanks for your help.


Doesn’t {{Name}} need to be in triple brackets?