I'm using the sample code from this part of the Developer's Guide to create Chatter Posts when certain conditions are met on a Case record. It all works well, but I'm not seeing any way that I can assign a topic to each FeedItem that is created with this code, unless I iterate through the ConnectAPI.BatchResult to find the Id of the resulting FeedItem records and then insert a TopicAssignment for each record.

Is there some method I'm not seeing that will allow me to create the FeedItem records and assign the Topic all at the same time?


Unfortunately, as of Winter '15, it's not possible to assign a topic at the same time a feed item is posted. However, if you use a hashtag in the body of the feed item, the topic for that hashtag will get assigned to the feed item at posting time. Maybe that will work for your use case -- but if you need to assign the topic without using a hashtag, it's not possible until after the feed item gets posted.

  • I tried the hashtag in the body thing and it does work, but I really don't like the way it looks. Is there anything that will accept a list of FeedItem or FeedItem Id and assign a Topic? Something similar to ConnectApi.Topics.assignTopicByName(communityId, feedItemId, 'Topic');? – mkdjns Dec 12 '14 at 18:05
  • For a list of feed items, you'd have to do a bulk insertion of TopicAssignment, similar to what you described in your original post. There isn't a way to do it with the ConnectApi.Topics class yet. – alouie Dec 12 '14 at 21:55

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.