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
nikita dhamalnikita dhamal 

Compile Error: sObject type 'NewsFeed' is not supported. at line 50 column 33

I have written used the below code in my apex class and got hte error : " Compile Error: sObject type 'NewsFeed' is not supported"
public List<NewsFeed> getNewsFeed()  {                                // Retrieving all feeds form Newsfeed
        List<NewsFeed> myfeed = [SELECT Id, Type,
                         CreatedById, CreatedBy.FirstName, CreatedBy.LastName,CreatedDate,
                         ParentId, Parent.Name, 
                         Body, Title, LinkUrl, ContentData, ContentFileName,
                             (SELECT Id, FieldName, OldValue, NewValue
                              FROM FeedTrackedChanges ORDER BY Id DESC), 
                             (SELECT Id, CommentBody, CreatedDate,
                              CreatedBy.FirstName, CreatedBy.LastName
                              FROM FeedComments ORDER BY CreatedDate LIMIT 10),
                             (SELECT CreatedBy.FirstName, CreatedBy.LastName
                              FROM FeedLikes)
                         FROM NewsFeed
                         ORDER BY CreatedDate DESC, Id DESC
                         LIMIT 20];
           return myfeed;
    }
 can anyone teel me solution to remove this error??
Thiyagarajan Selvaraj (SFDC Developer)Thiyagarajan Selvaraj (SFDC Developer)
Hi Nikita, 

NewsFeed is available in API version 18.0 through API version 26.0. In API version 27.0 and later, NewsFeed is no longer available. 

Thanks,
Thiyagarajan Selvaraj. 
AshlekhAshlekh
Hi

NewsFeed is available in API version 18.0 through API version 26.0. In API version 27.0 and later, NewsFeed is no longer available in the SOAP API. Use the Chatter REST API to access NewsFeed.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_newsfeed.htm

-Thanks
Ashlekh Gera