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
wadams2010wadams2010 

Visualforce Component Error 'Read only property' when querying ContentDocumentLink

I'm working on making a Visualforce Email Template and I want to show all related Files related to a record. When I try saving out my Visualforce Component it gives the following error: 'Read only property 'c:compProdInitFiles.ContDocLinks''

I tried removing the 'set' from my class to make it read only but it still throws the error. Any ideas on how to fix? I would think this would be simple but can't resolve. Code is below. Thanks in advance!

Visualforce Component:
 
<apex:component controller="prodInitFiles" access="global">
<apex:attribute name="relatedId" type="Id" description="Id of the account" assignTo="{!ContDocLinks}"/>
<table border = "2" cellspacing = "5">
    <tr>
        <td>DocumentId</td>
        <td>Title</td>                
    </tr>
    <apex:repeat value="{!ContDocLinks}" var="f">
    <tr>
        <td>{!f.ContentDocumentId}</td>
        <td>{!f.ContentDocument.title}</td>              
    </tr>
    </apex:repeat>        
</table>

Class:
public class prodInitFiles {

public Id relatedId {get;set;}
public List<ContentDocumentLink> getContDocLinks()
{
    List<ContentDocumentLink> contDocLink;
    contDocLink = [SELECT ContentDocument.title, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId =: relatedId];
    return contDocLink;
}}

 
Alain CabonAlain Cabon
Hi,

<apex:attribute name="relatedId" type="Id" description="Id of the account" assignTo="{!relatedId}"/>

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_comp_cust_elements_controllers.htm