2

I am trying to add multiple Topic for a chatter post through APEX code. I am trying to give topics as comma separated value (Test1,Test2,Test3).

But when I check in chatter post its coming as a single topic . I cannot select only Test1 or Test2 or Test3 .When clicking the Topic its showing as a single string.

Please suggest some work around for this problem through APEX code.

Thanks
Arabinda

1 Answer 1

3

Would you be able to make multiple calls to either the ConnectApi.Topics.assignTopicByName() or ConnectApi.Topics.assignTopic() methods? For example:

ConnectApi.Topics.assignTopicByName(communityId, feedItemId, 'Test1');
ConnectApi.Topics.assignTopicByName(communityId, feedItemId, 'Test2');
ConnectApi.Topics.assignTopicByName(communityId, feedItemId, 'Test3');

Documentation for the ConnectApi.Topics class

If this isn't the solution you're looking for, can you please supply some sample code to show what you're trying to do?

6
  • 1
    Hi Alouie ,this solution is fine , but cannot we provide all the topics at once for a Chatter post ? like ConnectApi.Topics.assignTopicByName(communityId, feedItemId, 'Test1,Test2,Tes3');
    – Arabinda
    Commented Sep 2, 2014 at 16:15
  • I tried the above solution.Its working fine.But I am calling the above method in loop and passing the Topic names and there is no API for this to add at once to add all the Topics for a post.Thanks for your suggestion.
    – Arabinda
    Commented Sep 2, 2014 at 16:59
  • Currently there isn't a way to supply multiple topics at the same time.
    – alouie
    Commented Sep 3, 2014 at 18:25
  • 1
    I know I'm late in this discussion.. but do we need anything else to make this work. Simple calling the assignByTopicName method doesn't work for me. It throws incorrect method signature error.
    – BlueBantoo
    Commented Feb 9, 2015 at 6:20
  • Which API version are you using? It's available in v29.0 and later. Here's the documentation: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – alouie
    Commented Feb 9, 2015 at 14:08

You must log in to answer this question.

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