Experience Cloud
通过Apex的方式上传 Topic:
String communityId = [Select Id from Network where Name = 'MobileMNOCS'].Id; Integer depth = 3; ConnectApi.ManagedTopicCollection managedTopic = ConnectApi.ManagedTopics.getManagedTopics( communityId,ConnectApi.ManagedTopicType.Navigational,depth ); // you can set this map in constructor and can return this varible Map<String, Map<String, List<String>>> pChildSubChildTopicsMap = new Map<String, Map<String, List<String>>>(); Map<String, List<String>> childTopicsMap; List<String> subChildTopicslist; for(ConnectApi.ManagedTopic parentTopic : managedTopic.managedTopics){ childTopicsMap = new Map<String, List<String>>(); system.debug('Level1: ' + parentTopic.id + ' : ' + parentTopic.Topic.Name); for(ConnectApi.ManagedTopic childTopic : parentTopic.children){ subChildTopicslist = new List<String>(); system.debug('Level2: ' + childTopic.id + ' : ' + childTopic.Topic.Name); for(ConnectApi.ManagedTopic subChildTopic : childTopic.children){ //subChildTopicslist.add(subChildTopic.Topic.Name); system.debug('Level3: ' + subChildTopic.id + ' : ' + subChildTopic.Topic.Name); } //childTopicsMap.put(childTopic.Topic.Name, subChildTopicslist); } //pChildSubChildTopicsMap.put(parentTopic.Topic.Name, childTopicsMap); }
之后获取0mt 开头的ID做为参数传入:
// string commId = [Select Id from Network where Name = '***'].Id; // ConnectAPI.ManagedTopics.createManagedTopicByName(commId, '0517aaaaa',ConnectApi.ManagedTopicType.Navigational,'0mt');
此刻,静下心来学习