I have written some apex to 'auto-tag' a record to a Topic if that topic keyword is mentioned in one of the description fields for said record. This will ensure that anyone who follows that topic will see the record in their feed - without the record creator adding the topic manually.

By adding a record to the FeedItem 'table' and simply adding the #topic to the body text - it automatically creates the topic assignment. This works very well for single word topics.

The issue is with topic names that have a space in them - when I add the #Topic Name hash tag, it creates a new topic for the #Topic part but the 'Name' part is treated as normal text. It subsequently creates a new Topic and assigns this to the FeedItem in the TopicAssignment object.

Is there some sort of delimiter that I can use so when I insert a record into FeedItem that contains hashtags (topics) it will pick up the whole hash tag with spaces? - I tried double quotes but it didn't work.

1 Answer 1


Yes, here's the syntax:

#[multi-word topic]

You must log in to answer this question.

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