function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Karthick RajaKarthick Raja 

Post Feed comment dynamically

Hi folks,
Can anyone tell me the answer for the following ques:
Is there anyway to post a feed comment dynamically for the particular feeditems in visualforce?

How to get the FeedItemId that I posted previously?


Thanks in advance
Karthick
Vikash TiwaryVikash Tiwary
Query on FeedItem to get the Id which you posted previously.
[select Id from FeedItem order by CreatedDate Desc limit 1]

For posting comment if you also need to include @mention in comment you should use connectApi method as below.
ConnectApi.ChatterFeeds.postComment(communityId, feedItemID, input, null)

If you do not require @mention in comment you can directly insert in to FeedComment object.

Hope this helps!

Thanks