You need to sign in to do that
Don't have an account?
TatianaSmirno
Retrieving comments
I am very new to this sorry. I've tried to use the chatter code recipie to retrieve comments on a feed item, but what code can I use to display it on my visual force page?
List<NewsFeed> myfeed = [SELECT Id, Type,
CreatedById, CreatedBy.FirstName, CreatedBy.LastName,
ParentId, Parent.Name,
Body, Title, LinkUrl, ContentData, ContentFileName,
(SELECT Id, FieldName, OldValue, NewValue
FROM FeedTrackedChanges ORDER BY Id DESC),
(SELECT Id, CommentBody, CreatedDate,
CreatedBy.FirstName, CreatedBy.LastName
FROM FeedComments ORDER BY CreatedDate LIMIT 10),
(SELECT CreatedBy.FirstName, CreatedBy.LastName
FROM FeedLikes)
FROM NewsFeed
ORDER BY CreatedDate DESC, Id DESC
LIMIT 20];
In my visualforce page I use:
<apex:dataTable value="{!userFeeds}" var="uf" >
I use {!uf.createdby.Firstname} to get the first name but I do not know how to get the comment body out.
Can you suggest what I could try?
Thankyou...sorry my english is not good.
Hi Tatiana,
the SOQL query retrieves a list of feeds and their related records, like comments, which are also lists.
You should be able to iterate again over the FeedComments list using the datatable as you have done for NewsFeeds.
Something like this:
i have tried to get comments,but i am not getting comments on Vfpage,can u plesae guide me to get comments on Vfpage,
i am pasting code which i have using,
Controller:-
Page:-
===========================================
<apex:page controller="commentsController">
<apex:dataTable value="{!userFeeds}" var="uf">
{!uf.createdBy.FirstName}
<apex:dataTable value="{!uf.FeedComments}" var="uc">
{!uc.CommentBody}
</apex:dataTable>
</apex:dataTable>
</apex:page>
please help me.
Thanks In Advance
Sri