2

I have requirement to fetch comment likes. I'm not able to figure out on how to retrieve commentlikes.

FeedLike object represents likes. You can't query FeedLike records directly. They can only be queried via the parent NewsFeed, UserProfileFeed, or entity feed, such as AccountFeed.

So to query FeedPost likes, use following:

SELECT Id, (SELECT Id, CreatedById, CreatedDate, FeedItemId, FeedEntityId FROM FeedLikes) FROM UserFeed

to query group post likes, use following:

SELECT Id, (SELECT Id, CreatedById, CreatedDate, FeedItemId, FeedEntityId FROM FeedLikes) FROM CollaborationGroupFeed

How to retrieve comment likes?

Chirag Mehta
  • 775
  • 10
  • 16

2 Answers2

1

They are available through the Chatter REST API: http://wiki.developerforce.com/page/Chatter_API

evilfred
  • 2,314
  • 4
  • 29
  • 44
0

I think you want to ChatterActivity SObject

Select c.ParentId, c.LikeReceivedCount, c.Id, c.CommentReceivedCount From ChatterActivity c

This should get what you are looking for.

EDIT:

Strange, I don't seem to be able to find anything on doing this in apex, you can do it through the api by calling

/chatter/comments/commentId/likes

So it should be possible somewhere along the line.This could work as a workaround though.

pbattisson
  • 1,230
  • 2
  • 10
  • 24
  • ChatterActivity represents the number of posts and comments made by a user and the number of comments and likes on posts received by the same user. It doesn't provide me information on where and when a comment is liked. – Chirag Mehta Dec 12 '11 at 14:16