You need to sign in to do that
Don't have an account?
kodeX
Retrieve comments
After executing the following SOQL query-
SELECT FEEDPOST.BODY,FEEDPOST.FEEDITEMID,FEEDPOST.PARENTID,"+
"(SELECT Id, CommentBody FROM FEEDCOMMENTS) FROM" +
" NEWSFEED WHERE TYPE = 'USERSTATUS' ORDER BY CreatedDate DESC, ID DESC");
In Soap, How to get the CommentBody while iterating in the loop?
1. s.getChild("FeedComment").getField("CommentBody") OR
2. s.getChild("CommentBody").getValue();
Note that Above 2 statements dont yield successful results!
What is the solution?
queryResults = connection.query
("SELECT Id,FeedPost.Body,FeedPost.FeedItemId, (SELECT Id,CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId='XXXXXXXXXXXXX');
Please check for retriving comments for particular NewsFeed.
Thanks,
Devendra
All Answers
Hi kodeX,
Try this:
Hope this helps.
Thanks,
Devendra
There is no method debug in "System" class.
Executing the SOQL query returns QueryResults object, which is incompatible with NewsFeed object.
Dev,Please provide appropriate working solution!
Hi kodeX,
From your org, Please take Id of FeedItem which has few comments on it.
Hard Code the id in above query and execute the code in your Sytem Log.
I will check for the SOAP API.
Thanks,
Devendra
I hard coded feeditemid as you said,
but it is returning all the comments on all posts, not of a specific post!
How can i get comments for a specific post?
Hi kodeX,
Can you please your code here?
Thanks,
Devendra
I have specified FeedItemId.
Here it is-
queryResults = connection.query
("SELECT Id,FeedPost.Body,FeedPost.FeedItemId, (SELECT Id,CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId='XXXXXXXXXXXXX');
Please check for retriving comments for particular NewsFeed.
Thanks,
Devendra
Hey thanks its Working for retreiving comments for particular user in your whole newsfeed!
To get comments for each post the soql query is-