I've found quite a bit of literature on my error, but most of it is above my head, unfortunately. What I'm trying to do is run 2 queries, put them in lists, then run a third query with the list of returned values as parameters. (This is the most effecient way I can think of, so if there are other alternatives, please advise.)
Here is my code for queries:
List<TopicAssignment> ta = [SELECT EntityId FROM TopicAssignment WHERE TopicId = '0TO30000000Xea1GAC'];
System.Debug(ta);
List<CollaborationGroupFeed> cgf = [select ParentId from CollaborationGroupFeed WHERE ParentId = '0F936000000cWkMCAU'];
System.Debug(cgf);
List<FeedItem> chatFeed = [SELECT Id, Body, CommentCount, CreatedDate, LikeCount, LinkUrl, ParentId, RelatedRecordId, Title, Type,
(SELECT Id, CommentBody, CreatedDate, CreatedById, FeedItemId, ParentId FROM FeedComments)
FROM FeedItem
WHERE (Id IN :ta
OR ParentId in :cgf)
AND CreatedDate >= 2015-12-15T00:00:00Z];
My where
is where I'm running into an issue. When I use Id in :ta
I get the following
Invalid bind expression type of TopicAssignment for Id field of SObject FeedItem
and then when I try Id in :ta.EntityId
I get
Initial term of field expression must be a concrete SObject: List
Could anyone please breakdown for me (in simple-ish terms) why this is happening and what I can do to fix? I realize that ta
and cgf
are lists, but shouldn't my where
be able to compare to these lists? When I debug, I see the list but calling out the value I want isn't cutting it. Here's what the first query returns:
DEBUG|(TopicAssignment:{EntityId=0D53600000VqxQFCAZ, Id=0FT36000001AuzEGAS}, TopicAssignment:{EntityId=0D53600000VqxUlCAJ, Id=0FT36000001AuzJGAS}, TopicAssignment:{EntityId=0D53600000WXUzfCAH, Id=0FT36000001AvglGAC})
Name
. Thank you for pointing this out.