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

How do I use getFeedElementsFromFeed

I am trying to replace a chatter feed I use in a VF page, in the past I used 
return ConnectApi.ChatterFeeds.getFeedItemsFromFeed(communityId, ConnectApi.FeedType.Record, groupId).items

But that has gone away in api 31 (it also just broke on its own somehow) and I want to use the most up-to-date way of getting the data. I am getting  the error   Line: 6, Column: 90 unexpected token: ','  when I try and run this in execute anonymous,
private static List<Community> customCommunity = [Select NetworkId, Name From Community where name = 'Sales Community'];
    private static String communityId = customCommunity[0].NetworkId;
    private static List<CollaborationGroup> CollaborationGroup = [SELECT Id FROM CollaborationGroup where name = 'Agency Forum'];
  	private static String groupId = CollaborationGroup[0].Id;

	public static ConnectApi.FeedElementPage ConnectApi.getFeedElementsFromFeed( communityId , ConnectApi.FeedType.Record , groupId);

I can find no real world examples of how to do this
NagaNaga (Salesforce Developers) 
Hi MrHammy,

In API versions 30.0 and earlier, a Chatter feed was a container of feed items. In API version 31.0, the definition of a feed expanded to include new objects that didn’t entirely fit the feed item model. The Chatter feed became a container of  feed elements. The abstract class ConnectApi.FeedElement was introduced as a parent class to the existing  ConnectApi.FeedItem class. The subset of properties that feed elements share was moved into the ConnectApi.FeedElement class. Because feeds and feed elements are the core of  Chatter, understanding them is crucial to developing applications with Chatter in Apex. For detailed information, see Working with Feeds and Feed Elements.

Please follow the below link for more info

Best Regards
Naga Kiran
On line 6, the ChatterFeeds class name is missing. ConnectApi.getFeedElementsFromFeed should be ConnectApi.ChatterFeeds.getFeedElementsFromFeed.
jody_blyjody_bly (" target="_blank)