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
Brian Chipman 4Brian Chipman 4 

Visualforce: Display chatter posts as a related list

Looking for a way to compactly display all chatter posts on a record in the standard view.  Perhaps a table with a couple of identifying fields and the body of the posts.  Was thinking of a vf page embedded in the layout using apex:relatedlist, but in that case, how would I reference the chatter object if possible?

Perhaps a vf page, embedded in the layout, but some other way to display chatter post records in a table?  Any code snippets, articles, examples, would be appreciated. If it looked like any other related list, perhaps with some scrolling in teh case of many posts, that would be great.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Brian,

Greetings to you!

You can include the chatter feed for the particular record using the chatter:feed visualforce tag. In the entity Id attribute, you need to pass the id of the record.
 
<chatter:feed entityId="{!Account.ID}" />

Please refer to the below links which might help you further with the above requirement.

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

https://salesforce.stackexchange.com/questions/71465/visualforce-page-to-show-all-chatter-posts-on-contact-and-all-related-records

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Brian Chipman 4Brian Chipman 4
Thanks Khan.  However, we are not looking to add Chatter to the page.  We want to display the chatter post records just like records are displayed in a related list on a standard page; a more compact view without all the visual overhead, each record taking up only one line of text unless the body is long or we display a lot of fields.  Something with output like...
 
<apex:relatedList list="Cases" />

...or other table-like display.