Posted in Salesforce

Salesforce: Display Related Files of Parent in Child Record

To display files of Parent Record in Child Record as a Related List, you can make use of <apex:relatedList>

  1. Create a Visualforce Page
  2. Use the following code:
<apex:page standardController="Child__c">
<apex:relatedList subject="{!Child__c.ParentField__c}" list="AttachedContentDocuments" />
</apex:page>

Replace Child__c and ParentField__c with appropriate object and associated relationship fields.

AttachedContentDocument is a read-only object that contains all ContentDocument objects associated with an object. Here, ContentDocument of Parent object as we have mentioned ParentField in subject attribute.

  1. Finally, edit the layout of your child record detail page.
  2. Add the Visualforce page under one of the section

This should list the Files from your parent into your child record page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s