0

I am able to get all of chatter feeds by querying 'FeedItem' object.

For example: SELECT Id, Title, Body FROM FeedItem

But, I am getting trouble to get feeds what a specific follow.

Is it possible to use Apex to get the feeds which a user follows?

1

You can either find the records a user is following through EntitySubscription, or leverage the NewsFeed which will give you the same Feed Items as what you can find on the home tab.

| improve this answer | |
  • The "What I follow" is bigger than " EntitySubscription", and it is not the answer. As one doesn't have any " EntitySubscription", one can still have feeds in the "What I follow". NewsFeed is probably the answer, but it is not supported any more. – Cray Kao Oct 24 '16 at 13:42
  • 1
    Not sure I got your point. EntitySubscription will get you all the records and users you are following, so you can then get the Feed Items related to these records even if it could be painful. NewsFeed should be easier, and is still supported by the REST API. – Fabien Taillon Oct 24 '16 at 14:46
  • Thank you. yes, it is supported by the REST API. I just found a way to get the expected result of "What I follow". But it does not work with SOQL, it is so painful to query the specific post record (feeditem) and its attributes. – Cray Kao Oct 24 '16 at 16:13
  • In Apex, you can use the ConnectApi.ChatterFeeds class. Here's an example of getting your news feed: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… – alouie Oct 25 '16 at 5: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.