0

I'm trying to build a query which would get all comments and the Topics assigned to the FeedItem they belong to but looks like I have hit a snag.

This is what I'm trying right now -->

SELECT Id, FeedItemId, ParentId, FeedItem.Title, CommentBody FROM FeedComment Limit 10

But I get this error -->

Didn't understand relationship 'FeedItem' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

I want to be able to get the following fields in my result -- FeedItem.Title and the Topic(s) assigned to that FeedItem.

Any help would be appreciated.

1 Answer 1

0

I don't think you can able to get Feed Item values based on Feed Comment, Since Feed Item is behave the std parent in here,

But You can use to query Feed Item and able to query Feed commentas a nested one as,

 List<FeedItem> feedItemlist =  SELECT Id, Title FROM FeedItem WHERE Id (SELECT FeedItemId FROM FeedComment LIMIT 10)

Which return the FeedItem Id required, After you can use that feedItemlist variable to form this Map

Map <Id, FeedItem> feedMap = new Map <Id, FeedItem>(feedItemlist);

After write a below query to get topic assigned for that feeditem (key of that Map),

SELECT Id, TopicId FROM TopicAssignment WHERE EntityId IN: feedMap.keySet())

Please let me know if it helps.

1
  • 1
    Yeah thought so, I'll ultimately have to use some workarounds.
    – Maverick
    Commented Nov 2, 2021 at 16:00

You must log in to answer this question.

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