+ Start a Discussion

Notes and Attachment in VFP

I have a custom object called object__c instead of the standard related list I have a visualfprce page

<apex:page standardController="Pobject__c">      

  <apex:form >

<apex:pageblock >
<apex:pageBlockTable Value="{!object__c.NotesAndAttachments}" var="item" columns="4" >

<apex:column HeaderValue="Title"  >   
<apex:outputLink value="/{!item.id}" id="the_link" >
<apex:outputField value="{!item.Title}" />
<apex:column HeaderValue="Last Modified Date" >
<apex:outputField value="{!item.LastModifiedDate }" />
<apex:column HeaderValue="Created By" >
<apex:outputField value="{!item.Createdbyid }" />






When I click on the attachment link, insetad of opening the attachment , it opens like this

User-added image

Best Answer chosen by Sabrent
Oh !!! I i missed  target= "_blank"

<apex:outputLink value="/{!item.id}" id="the_link"  target= "_blank">

All Answers


You have to use below link to get/download file


Replace ???? with you server instance and id with your file id.

Thanks, but i don't want to hardcode the url / File id

FYI, If i right click and open in new tab, it opens in a new window correctly

Buy left click opens within the same page instead of openeing in a new window.

Seems like  i am missing something obvious.

Oh !!! I i missed  target= "_blank"

<apex:outputLink value="/{!item.id}" id="the_link"  target= "_blank">
This was selected as the best answer