You need to sign in to do that
Don't have an account?
Sabrent
Notes and Attachment in VFP
I have a custom object called object__c instead of the standard related list I have a visualfprce page
<pre>
<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:outputLink>
</apex:column>
<apex:column HeaderValue="Last Modified Date" >
<apex:outputField value="{!item.LastModifiedDate }" />
</apex:column>
<apex:column HeaderValue="Created By" >
<apex:outputField value="{!item.Createdbyid }" />
</apex:column>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
</pre>
When I click on the attachment link, insetad of opening the attachment , it opens like this
<pre>
<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:outputLink>
</apex:column>
<apex:column HeaderValue="Last Modified Date" >
<apex:outputField value="{!item.LastModifiedDate }" />
</apex:column>
<apex:column HeaderValue="Created By" >
<apex:outputField value="{!item.Createdbyid }" />
</apex:column>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
</pre>
When I click on the attachment link, insetad of opening the attachment , it opens like this
<apex:outputLink value="/{!item.id}" id="the_link" target= "_blank">
All Answers
You have to use below link to get/download file
https://c.????.content.force.com/servlet/servlet.FileDownload?file=id
Replace ???? with you server instance and id with your file id.
Thanks,
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.
<apex:outputLink value="/{!item.id}" id="the_link" target= "_blank">