1

We need to give community user ability to like the feed item. Tried below code.

ConnectApi.ChatterFeeds.updateLikeForFeedElement(communityId,feedItemId, true);

Error:

System.NoAccessException: Insufficient Privileges: You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

This code is working with the standard user but not for the community user. Is there any setting for this?

7
  • can that user like posts from standard SF chatter ui? Commented Aug 2, 2019 at 13:01
  • @PranayJaiswal Yes, I am able to like from there Commented Aug 2, 2019 at 14:50
  • If I am not wrong ConnectAPI kinda uses rest callouts, can you try doing it by just inserting FeedLike ? INSERT new FeedLike (FeedItemId = FeedEntityId); . FeedLike Commented Aug 2, 2019 at 15:04
  • @PranayJaiswal this is giving me the error = You can like or unlike posts, comments, and other feed item types only after they're published. Commented Aug 2, 2019 at 15:19
  • I can't think of anything else, on the last try can you try this bit. INSERT new FeedLike (FeedEntityId= FeedEntityId); Commented Aug 2, 2019 at 15:35

1 Answer 1

1

ConnectApi does a callout using sessionId, as of now lightning session is not API enabled and that might be failing your code to like the post.

You can manually insert FeedLike

INSERT new FeedLike (FeedItemId = FeedEntityId);

You must log in to answer this question.

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