• Alistair Field 8
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I would like to automatically add a topic to Question asked in the Community.
I have the following apex trigger that works for all posts. But I would like to add in a statement that ONLY makes it works on Question type posts on a community and not internal org.

Thanks in advance.
trigger AddingQtopic on FeedItem (after insert) {
      List<TopicAssignment> taList = new List<TopicAssignment>();
    for(FeedItem c : trigger.new){
  TopicAssignment ta = new TopicAssignment();
  ta.TopicId = '0TO400000000NCE';
  ta.EntityId = c.Id;  
        taList.add(ta);
    
    insert taList;    
        }
    }