2

hey guys my query for some reason is failing to understand the relationship here, though I'm being pretty explicit in my subselect. I've tried all three of the following and received three different errors...

SELECT Id, Name, 
(
  SELECT Id, ParentId, Body 
  FROM CollaborationGroupFeeds
)

FROM CollaborationGroup

# Didn't understand relationship 'CollaborationGroupFeeds' in FROM part of query call.

So lets explicitly make the relationship

SELECT c.Id, c.Name, 
(
  SELECT Id, ParentId, Body 
  FROM CollaborationGroupFeeds
  WHERE ParentId = c.Id
)

FROM CollaborationGroup c

# unexpected token: 'c.Id' 

=/

I've also tried this inverse and without c etc

  • 1
    Try Select c.Parent.MemberCount, c.Parent.Name, c.ParentId, c.Id, c.CreatedDate, c.Body From CollaborationGroupFeed c – techtrekker Mar 22 '13 at 17:22
  • @techtrekker that works amazingly well, is there documentation somewhere about Parent. that I missed? Is there a way to select CollaborationGroupFeed Comments as well?? – ehime Mar 22 '13 at 17:49
  • If you've got the IDE open up the schema browser or alternatively try workbench.developerforce.com, where you can effectively build your SOQL queries, particularly when you want to span relationships. – techtrekker Mar 22 '13 at 18:12
  • 1
    @ehime The difficulty with these things is knowing where you're at in the parent/child tree. If you haven't already installed it, I've found Ajax Tools (Free) which has a very useful Query editor, to be extremely helpful in constructing these kinds of queries. It also shows the parent/child tree which is helpful in learning to construct queries of this type on the fly. – crmprogdev Mar 22 '13 at 18:15
  • I'm currently using a query editor that I scratch built and Workbench. i'm not sure how to view the relationships. I'll look into the Ajax Toolkit though, it looks promising. Do you have a reference uri? – ehime Mar 22 '13 at 18:25
2

The object name should be "Feeds" and not CollaborationGroupFeeds.

Try this:

SELECT Id, Name, 
(
  SELECT Id, ParentId, Body 
  FROM Feeds
)

FROM CollaborationGroup
  • I understand what you mean now. Accepted. – ehime Mar 22 '13 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.