You need to sign in to do that
Don't have an account?
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:
Class:
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; }}
<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