I’m having an issue displaying content documents in a table. There are many content objects. I tried Content Documents which got me just about everything I need except that it doesn’t have a Parent Id. I then tried AttachedContentDocument and I get the following Error if I try to put it in a model: “1. An error occurred while attempting to perform the following SOQL query: SELECT LastModifiedDate,ContentSize,ContentUrl,ContentDocumentId,ContentDocument.Title,CreatedDate,CreatedById,CreatedBy.Name,FileExtension,FileType,LastModifiedById,LastModifiedBy.Name,LinkedEntityId,Title,Id FROM AttachedContentDocument LIMIT 21 Error:entity type AttachedContentDocument does not support query” I then made a table out of the parent object “Patient” and it lists the attached content documents in the table, but I can’t link to the actual file. I see a tutorial on how to upload files to Chatter/Content and that seems to work well, but I can’t get linked content documents to display in a table with live links that take me to the document. Any ideas would be appreciated.
I am stuck on this. Every road leads to a dead end. If someone could give a quick overview of how one would display content documents in a list and create a URL to the actual document that I could preferably use in a row action to display in a popup window (for browser based files like PDF’s) , I would be super grateful!
Figured it out, for anyone who may stumble across this post. I ended up creating a model based on the ContentDocumentLink object then created a condition that the LinkedEntityID is equal to the parent record id and I pulled fields from the ContentDocumentId object when picking the fields to bring into the model to get the file name, type, size, etc… Important note, the clickable link for the file name is actually ContentDocumentId. The title field will give you a dead version of the document name.
Glad you got it figured out. The other way you can get “clickable” content documents is by using the contentVersions child relationship and using href code in your template to build out a link.
I built a sample page using this method. Grab the xml at that link and spin up a new page to check it out.