I am using the following method to share a file to a group.

ConnectApi.FeedItem feadItem = ConnectApi.ChatterFeeds.postFeedItem(communityId, feedType, subjectId, input,filebody);

I want to add topic to the feed item.



In order to add a topic to a feed item, you need to post the feed item first, and then call either ConnectApi.Topics.assignTopic() or ConnectApi.Topics.assignTopicByName(). It's not possible currently to assign the topic and post the feed item in a single call. See the documentation for the ConnectApi.Topics class for more info.

  • assignTopicByName(communityId, recordId, topicName) this method asks for recordId. How can i get the record id from the feedItem Variable ? – Monish Sep 16 '15 at 5:11
  • Use the feedItem's ID as the recordId. – alouie Sep 16 '15 at 16:04

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.