Due to the way this is structured I can't bring back groups with no comments/feeds in them, unfortunately trying to invert this brings up multiple errors as CollaborationGroup
does not understand the relationship it has with CollaborationGroupFeed
.
Here is the query:
SELECT
c.Parent.Id,
c.Parent.OwnerId,
c.Parent.CreatedById,
c.Id,
c.ParentId,
(
SELECT
Id,
FeedItemId,
ParentId
FROM FeedComments
)
FROM CollaborationGroupFeed c
I can't do it like this though for whatever reason:
SELECT
Id,
OwnerId,
CreatedById,
(
SELECT
Id,
ParentId
FROM CollaborationGroupFeeds
),
(
SELECT
Id,
FeedItemId,
ParentId
FROM FeedComments
)
FROM CollaborationGroup
Didn't understand relationship 'CollaborationGroupFeed' in FROM part of query call.`
EDIT
So lets say I have a Group that I just created called Foo
[FOO]
Foo has one Post in it BlahPost
[FOO]
|
|_BlahPost
Lets say BlahPost
has a comment (or several)
[FOO]
|
|_BlahPost
|_Comment 1
|_Comment 2
The query above will return all of this.
Now lets say I have a new Group Bar
[Bar]
Since there are NO posts/comments the query above returns nothing since I'm working from child to parent,
and parent has no posts. I am looking for a query that starts at the parent CollaborationGroup
and moves
down to CollaborationFeed
which will display FeedComment
Make more sense? The order is mess up, I'm working from the middle and should be working from the top
Try using Chatter in Apex, which is Chatter REST API resource actions exposed as static methods in the Apex ConnectApi namespace. It's a much easier way to access Chatter data.
http://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_overview.htm
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_connect_api.htm