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
RojodeBearRojodeBear 

Recreating Notes and Attachments for Chatter Feed Content Posts Only

I am using Chatter to manage Files on a record. As this record will be available to both the Partner and Customer Portals, I need to show a version of the Notes and Attachments Related List to give access to the Files for these users. I am unable to use Notes and Attachments as we can't have users create Notes or upload Files of this type.

 

I can create a table with Custom_Object__c.Feeds to show the Chatter Feed, and use rendered="{!(feed.Type='ContentPost')}" to show only the Files, but I am stuck on how to create the links to view them.

 

I have a basic understanding of Chatter Files and Content, but where do I get the URI that will allow all users to download the File and for Chatter users to preview the file?

Jia HuJia Hu

FeedItem fi = [Select Id, Body, Title, RelatedRecordId From FeedItem Where Type = 'ContentPost'];

 

String filelink = URL.getSalesforceBaseUrl().toExternalForm()+ '/' + fi.RelatedRecordId;