function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rocks_SFDCRocks_SFDC 

How to write relationship queries in Chatter

Hi Folks,

I am new to chatter functionality.

we have "CollaborationGroup" and "FeedItem"

How to query on FeedItem and get  CollaborationGroup items.

After getting CollaborationGroup, i want to get the attachment id from it.

Please clarify !!!

Thanks,
Anil


Ashish_SFDCAshish_SFDC
Hi Anil, 



Salesforce admin can enable Chatter feed tracking on Salesforce object, include custom objects.
Go to Setup - App Setup - Customize - Chatter - Feed Tracking
Select object to track and tick "Enable Feed Tracking", you can select up to 20 fields.

In the background, once an object is enable for feed tracking, Salesforce will create new object end with suffix Feed (for Standard object) or _Feed (for Custom object). This is available in API version 18.0 and later.

Using SOQL, you can do this query:
Select Id, ParentId, Type, Title, Body, CommentCount, LikeCount, LinkUrl, RelatedRecordId, ContentFileName, ContentSize, ContentType From Object1__Feed
This query will return all feeds tag to Object1__c object only (see ParentId field)

Another object storing all feeds is FeedItem, this object avaiable in API version 21.0 and later.
Select Id, ParentId, Type, Title, Body, CommentCount, LikeCount, LinkUrl, RelatedRecordId, ContentFileName, ContentSize, ContentType From FeedItem Order By ParentId
This query will return all feeds tag to any objects.

See the blog ,

Query Chatter feed item & how the structure in Salesforce object

http://simplysfdc.blogspot.in/2013/03/query-chatter-feed-and-how-it-structure.html


Regards,
Ashish