开发者

How to retrieve FeedComment using Chatter SalesForce WSDL service in C#

开发者 https://www.devze.com 2023-03-27 16:19 出处:网络
I have to retrieve News feed of salesforce chatter I am able to get main status but not able to retrieve c开发者_StackOverflow社区omments. Is there any sample to get comments using SalesForce chatter

I have to retrieve News feed of salesforce chatter I am able to get main status but not able to retrieve c开发者_StackOverflow社区omments. Is there any sample to get comments using SalesForce chatter WSDL API in c#?


You can use child relationship queries to traverse from the NewsFeed to the child FeedComments. Here's an example of a SOQL query that returns both the main status and comments for a given user:

SELECT Id, Body, (Select Id, CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId = '00560000000wX0aAAE'

Not sure about C# specifically, but it will likely return the FeedComments as a nested array. Here's an example of iterating over the results in Apex:

NewsFeed nf = [SELECT Id, Body, (Select Id, CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId = '00560000000wX0aAAE'];

System.debug(nf.Id);
System.debug(nf.Body);
for (FeedComment fc : nf.FeedComments) {
   System.debug(fc.Id);
   System.debug(fc.CommentBody);
}


This will get you NewsFeed + Comments + Likes:

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 100
0

精彩评论

暂无评论...
验证码 换一张
取 消