You need to sign in to do that
Don't have an account?
Praneetha Murakonda
How to get sub topic related to selected Topic in apex?
Hi All,
I' creating a question from community. Question can be created from either Topic or Group. When ever i'm creating question there is an option to add sub topic related to selected Topic. I need to distinguish between primary topic and subtopic. How can i query subtopic related to selected primary topic in apex.
Please let me know if there is any workaround.
Thanks!
Hi Praneetha,
Please use below soql query : -
List<PrimaryTopic> lst_Primary = new List<PrimaryTopic>([Select Id,fields,(Select Id,fields from subTopic__r) from primaryTopic]);
Something as shown in above will be used.
Please let me know, if it works :)
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
Hi rajat,
Thanks for reply. Actually i need subtopic related to Topic (Standard object).
I need to get Topic and SubTopic related to feedItem. I'm getting Topic Id related to FeedItem from TopicAssignment object like below.
List<TopicAssignment> myFeedItemFeedAssignments = [SELECT Id, NetworkId, TopicId, Topic.Name, EntityId
FROM TopicAssignment
EntityId IN : feedItemId];
I will get TopicId but not able to get SubTopics. I didn't find any field on Topic object related to subtopic. Please suggest if there is any way to get SubTopics related to Topic
Did you get any solution for sub topic ?
Thanks,
Sudipta