You need to sign in to do that
Don't have an account?
Query only returns one comment
I'm doing a query for chatter that looks like this:
[SELECT Id, Type, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Body, Title, LinkUrl, ContentData, ContentFileName ,
(SELECT Id, CommentBody, CreatedDate, CreatedBy.FirstName, CreatedBy.LastName FROM FeedComments LIMIT 5)
FROM FeedItem WHERE ParentID =: objectId AND Type = \'TextPost\' ORDER BY CreatedDate DESC LIMIT 10]
The problem is that the query only returns one comment even though I specify a limit of 5 and I know there are more than 5 comments on the chatter post that I'm rendering. Any insights into why that might be?
Thanks!
Scott
... from feeditem where commentcount > 3 ....
and see what you got
So the using commentcount > 2 returns the item but still there is only one comment returned. The weird thing is the totalSize of the comment records is correct. Here's what the JSON output is for the comments.
"FeedComments":{"totalSize":4,"done":false,"records":[{"attributes":{"type":"FeedComment","url":"/services/data/v26.0/sobjects/FeedComment/0D7d0000000MpcMCAS"},"Id":"0D7d0000000MpcMCAS","CommentBody":"another comment","CreatedDate":"2012-12-03T18:51:24.000+0000","CreatedById":"005d0000001KC5fAAG","CreatedBy":{"attributes":{"type":"Name","url":"/services/data/v26.0/sobjects/User/005d0000001KC5fAAG"},"FirstName":"Scott","LastName":"Morrison"}}],"nextRecordsUrl":"/services/data/v26.0/query/01gd0000007XkeDAAS-1"}}]}
So it seems like done:false means it hasn't retrieved all the comments. Is there any way to force it to retrieve more than one comment? Or am I doomed to only showing one comment for each chatter post initially with a more link that retrieves the rest if there is more than one?
If you want to retrieve the Body part, you have to put the query in a loop way.