function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PecheurPecheur 

How Creates a child managed topic by name for a community?

Hello,
I want to include parent and children topics in my Community like this : https://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/rn_networks_subtopics.htm?edition=&impact=

I used ConnectApi.ChatterGroups.createManagedTopicByName(communityId, name, managedTopicType, parentId)
communityId=my CommunityID ('0DBM0000000CajLOAS')
name=name of child topic
managedTopicType = ConnectApi.ManagedTopicType.Featured
parentId = '0TOM00000004SHDOA2'  Id of parent topic

When I run this method I have this error message: ConnectApi.ConnectApiException: Illegal value for parameter: 'parentId': 0TOM00000004SHDOA2

Can you help me?

Best regards
Anis
Andy BoettcherAndy Boettcher
When I've seen that error in the past - the value you are passing for the ParentId is not a valid Id.  Are you 100% sure that the 0TO Id is proper and correct?
PecheurPecheur
I think that the parentid (in ConnectApi.ChatterGroups.createManagedTopicByName(communityId, name, managedTopicType, parentId)) must be a topic, so I put the id of the parent topic ''0TOM00000004SHDOA2''. no?
Robin SandlinRobin Sandlin
really...
Israel Luque SánchezIsrael Luque Sánchez
Too late for answer but you are passing Topic ID '0TOM00000004SHDOA2' this is a ID from Topic Object.
The method is waiting for a ManagedTopic Record, The managed Topic ID is like  ' 0mt1....' 

More info:
Topic Class:
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Topics_static_methods.htm#apex_ConnectAPI_Topics_methods
Managed Topic Class:
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ManagedTopics_static_methods.htm#apex_ConnectAPI_ManagedTopics_static_methods

Mark as Best answer! 

Thanks
Regards!