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

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


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?

  • can that user like posts from standard SF chatter ui? – Pranay Jaiswal Aug 2 '19 at 13:01
  • @PranayJaiswal Yes, I am able to like from there – rahul gawale Aug 2 '19 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 – Pranay Jaiswal Aug 2 '19 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. – rahul gawale Aug 2 '19 at 15:19
  • I can't think of anything else, on the last try can you try this bit. INSERT new FeedLike (FeedEntityId= FeedEntityId); – Pranay Jaiswal Aug 2 '19 at 15:35

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);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.