2

We have Requirement where we need to display the chatter Feeds in a visual force page without using the standard chatter tags . i have displayed the feeds in table ,now my requirement is i need to like a feed with apex code .am unable to figure it out could you guys help me to sort it out .

1 Answer 1

3

You can use these methods:

ConnectApi.ChatterFeeds.likeFeedItem(String communityId, String feedItemId) Documentation

ConnectApi.ChatterFeeds.likeComment(String communityId, String commentId) Documentation

2
  • so, on clicking Like (button), I should call this method passing the feedItem Id? (how do I pass the parameter on button click to the method?)
    – sfdcFanBoy
    Apr 20, 2015 at 9:41
  • @sfdcFanBoy If you are in LWC you'll want to capture the onclick event of your like button and then send it up to your Apex controller, which can then fire the likeFeedItem() method. Nov 16, 2021 at 1:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .