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
VishalAscVishalAsc 

FeedItem vs. record feeds

From reading the documenation about chatter, I am understanding that every post on chatter is a record on FeedItem.

Does it mean the record feeds are also a record in FeedItem?

If yes, then what is the purpose of duplicating the data in FeedItem and record feed (like AccountFeed).

If no, then can somebody tell me which feeds would be available in FeedItem and which feeds would be available in record feed objects?

 

Thanks,

Bakul

ChrisOctagonChrisOctagon

Chatter feed posts are FeedItems. The "parent" associated with a feed item is the associated record.

VishalAscVishalAsc

I am sorry, probably I wasn't clear.

I do understand the difference between FeedItem and the parent record.

But my question was, difference between the record of FeedItem and record on AccountFeed (or other entity feeds).

 

It looks to me that when you post a feed on Account, it is stored in two places

1) AccountFeed

2) FeedItem

 

So, my question is, why it is stored in two places?

 

Thanks,

ChrisOctagonChrisOctagon

I think that record feeds cover feeds on any type of records, whereas AccountFeed is only for account records.

VishalAscVishalAsc

So, the question is, why they are duplicating feed data in FeedItem as well as AccountFeed (or any other entity feeds)?

Also, if entity feeds are storing more information, they why there is no lookup to entity feed from FeedItem?

 

 

Bakul

ChrisOctagonChrisOctagon

I don't think that the data is necessarily truly duplicated in the underlying data store. I don't understand your question about entity feeds - FeedItems can be found in other feeds that are not entity feeds.

VishalAscVishalAsc

Hi Chris,

My apologies.. i will try to make myself clearer.

And my quetion is only in case a FeedItem is for entity feed.

 

Let's say that a user posts a feed on Account. So, a record will be created in AccountFeed, correct?

This feed will also create a record in FeedItem, correct?

 

If answer to both questions is yes, then only I have questions, and the questions are:

1) Why they are storing feeds in 2 places (no matter how much data is duplicated)?

2) Is there a way we can traverse from one to another? like from AccountFeed to FeedItem or from FeedItem to AccountFeed?

3) If data is not duplicated, then what are the fields in FeedItem that would have some values after the feed post?

 

Thanks,

Bakul

VishalAscVishalAsc

I realized that entity feed objects (like AccountFeed) do not store all the information that FeedItem stores.

But how do we get access to FeedItem record for a given AccountFeed?

 

AccountFeed has lookup to FeedPost, but that is depricated object replaced by FeedItem

But there is no way to go to FeedItem record from AccountFeed record.

And FeedItem is not queryable without Id in filter, so it is kind of hard stop.

 

Thanks

Bakul

ChrisOctagonChrisOctagon

I'm not an expert on the SObject api for feeds, but I think that if you want to get access to the feed items for a given Account you could do a SOQL query where you get FeedItems whose parent id matches the account id. Alternatively, you could retrieve the record feed through the Chatter API.

CarterCarter

Hey guys,

 

First of all, rest assured that there is no duplication of any of the data.  FeedItem is the only "real" table in the system.  AccountFeed, NewsFeed, and UserProfileFeed all act as views over that data.  You'll notice that you cannot insert into AccountFeed or its siblings like ContactFeed, nor can you insert directly into NewsFeed or UserProfileFeed.  You'll also notice that they all return IDs that start with 0D5.

 

When you create a FeedComment, you must specify a FeedItemId.  It really doesn't matter whether you got that ID via a query from FeedItem or AccountFeed or NewsFeed.  The ID still uniquely refers to a specific FeedItem.  After inserting the comment, when you use a sub-select to get the FeedComments in a query from FeedItem, AccountFeed or NewsFeed, you'll see the comment there in every case.  The comments aren't "duplicated" either.  They just appear in each view.  The same goes for FeedLikes.

 

You can think of AccountFeed as all of the FeedItem data, where Parent.Type = 'Account'.  It's not the feed items on one Account; rather it's the feed items parented by all Accounts.  When you add a WHERE ParentId = '001x00SomeAccount', you are limiting the scope to just the feed items on one Account, as is displayed on the Account detail page.

 

So, why not just query from FeedItem, WHERE ParentId = '001x00SomeAccount' ?  Good question.  Queries as a user without the View All Data permission are much much faster from AccountFeed than from FeedItem, because there is only one "sharing provider" used to filter out which feed items can be seen and which cannot:  the one for Accounts.  If a user without view-all-data were to query from FeedItem, there would be a cascade of sharing checks as the query executes.  This is the reason that only users with view-all-data can perform arbitrary top-level queries from FeedItem.

 

Hope this helps,

- Carter

 

VishalAscVishalAsc

Hi Carter,

Thanks for shading light on many facts I wasn't aware of, really appreciate.

 

The problem that I am facing is that, my client application needs to read all the feeds (all records in FeedItem) and store it in local system. But as you know, we cannot query FeedItem without supplying Id in where condition. And that's where everything stops for me.

 

In order to get all the FeedItems, I first need to get all the ids of FeedItems. So, I thought let me try to read AccountFeed first and let me see if based on that I can get FeedItem record. But there is no relationship between AccountFeed and FeedItem. So, I am not sure how to get all FeedItem records (or at least based on some datetime condition).

 

Really restricted by the requirement that we have to put id in filtering conditions when querying FeedItem.

 

Any help in this regard will be highly appreciated.

 

Thanks,

Bakul

Jia HuJia Hu

You can query all the Feeditem without filter of Id now, please check your API version.

 

As of API version 23.0 and beyond, if you have “View All Data” permission you can directly query for a FeedItem

 

Document is here:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_feeditem.htm

Jimmy HarrisJimmy Harris
If you want to "link" an AccountFeed record back to it's associated FeedItem record, use the following:
ParentID = ParentId
AND
CreatedDate = CreatedDate
AND 
CreatedById = CreatedById