I am trying to send emails to the owners of cases when people post to the case feed. Traversing up through parent records seems to have some strange functionality:
for(FeedItem FI : FeedItems ) { String Name = FI.Parent.Name; //works just fine ID id = FI.Parent.OwnerID; //returns "Variable does not exist: OwnerID"}
So I can go up one level to the name of the parent record, but not up another level to the owner of that record. I imagine some further querying is necessary, but I am stuck on how to do it without creating a query within a for loop (I know the query below is not in the for loop, I took it out, but trying to figure out where to go from here. Thoughts?
for(FeedItem FI : FeedItems ) { mapCaseIDtoFeedItem.put(FI.ParentID,FI); }for(Case C : [SELECT OwnerID FROM Case WHERE Id IN: mapCaseIDtoFeedItem.keySet()]){ ...something here?}