function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matt FolgerMatt Folger 

Having attachments showing up on a visualforce page

Seems simple enough, probably is like half a line of code.  

I have a VF page and I need that attachment list to show up as it does in the Page Layout.  Is that possible?
Best Answer chosen by Matt Folger
Vivek DeshmaneVivek Deshmane
<apex:page standardcontroller="RPP_Tracker__c" Extensions="steroid.RuntimeExtension,RPP_Tracker_DeleteAttachmentExtension">  <apex:relatedList list="CombinedAttachments" subject="{!$CurrentPage.parameters.id}" />

All Answers

Vivek DeshmaneVivek Deshmane
Hi Matt,
Please try below code and let me know.
<apex:page standardController="Account">
  <apex:detail relatedList="false"/>
  <apex:relatedList list="Attachments"  subject="{!$CurrentPage.parameters.id}" />
</apex:page>

Regards,
-Vivek
Matt FolgerMatt Folger
<apex:page standardcontroller="RPP_Tracker__c" Extensions="steroid.RuntimeExtension,RPP_Tracker_DeleteAttachmentExtension">
  <apex:detail relatedList="false"/>
  <apex:relatedList list="Attachments"  subject="{!$CurrentPage.parameters.id}" />

My header looks like above, because I'm using some 3rd party tools and some extensions.  But it doesn't compile saying "
'Attachments' is not a valid child relationship name for entity RPP Tracker "

Is that because of the extenions or is there something else?

Thanks for the post!

 
Vivek DeshmaneVivek Deshmane
It's wokring for even custom object with extension controlle and VF page version is 34. chnage version to 34 and try.
<apex:page standardController="Line_Item__c" extensions="lineItemExt">
  <apex:detail relatedList="false"/>
  <apex:relatedList list="Attachments"  subject="{!recordId}" />
</apex:page>
Please let me know if it helps you.
Best Regards,
-Vivek
Matt FolgerMatt Folger
<apex:page standardcontroller="RPP_Tracker__c" Extensions="steroid.RuntimeExtension,RPP_Tracker_DeleteAttachmentExtension">
  <apex:detail relatedList="false"/>
  <apex:relatedList list="Attachments"  subject="{!$CurrentPage.parameters.id}" />
Same error after updating to v34 API-level.

Am i missing some obvious syntax thing?  Should "CurrentPage" be the actual name of the present page or is that relevant? 
Edwin VijayEdwin Vijay
try using the following code
<apex:page standardController="RPP_Tracker__c">
<apex:detail relatedList="false"/>
<apex:relatedList list="NotesAndAttachments" subject="{!$CurrentPage.parameters.id}" />
</apex:page>

though i am not sure what's wrong with 'Attachments'
Matt FolgerMatt Folger
<apex:page standardcontroller="RPP_Tracker__c" Extensions="steroid.RuntimeExtension,RPP_Tracker_DeleteAttachmentExtension">
  <apex:detail relatedList="false"/>
<apex:relatedList list="NotesAndAttachments" subject="{!$CurrentPage.parameters.id}" />

I have to have those extensions in there, so I added that to your code you provided Forcetree.com.  

That said, it still errors out with "Visualforce ErrorHelp for this Page
'NotesAndAttachments' is not a valid child relationship name for entity RPP Tracker " when I try and save the header with the above code.
Vivek DeshmaneVivek Deshmane
Hi 
Try this.

<apex:page standardcontroller="RPP_Tracker__c" Extensions="steroid.RuntimeExtension,RPP_Tracker_DeleteAttachmentExtension"> <apex:detail relatedList="false"/> <apex:relatedList list="CombinedAttachments" subject="{!$CurrentPage.parameters.id}" />

Best Regards,
-Vivek
Matt FolgerMatt Folger
Very interesting.  That code Vivek is allowing me to compile but it's now showing the previous page (like a Page Layout), the attachments in the middle and the actual VF page at the bottom.  Very strange.  Any idea of why that might be happening?
Vivek DeshmaneVivek Deshmane
<apex:page standardcontroller="RPP_Tracker__c" Extensions="steroid.RuntimeExtension,RPP_Tracker_DeleteAttachmentExtension">  <apex:relatedList list="CombinedAttachments" subject="{!$CurrentPage.parameters.id}" />
This was selected as the best answer