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
Cyrus MajorCyrus Major 

Error when fetching FeedItem for some users.

I have been using the SF SOAP API for integrating and fetching the CRM documents into our app. I have referenced the latest WSDL into our app. Our application is in .NET and I have been using SOQL queries of SalesForce to successfully integrate. Recently we are trying to get the Chatter data into our app for the user to view and post messages. I have few questions regarding the same.

1.       I was able to get all chatter feeds of the entire company by fetching all records from “FeedItem” object. But I want to only fetch the feeds that are shown in “What I follow” in SF. I could not see a direct way or object which will provide me these feeds. So I wrote the following query to fetch and filter the same.

select Id,Body,ContentDescription,ContentFileName,CreatedDate,Title,Type,CreatedBy.FirstName,CreatedBy.LastName from FeedItem
where (ParentId ='<USERID that is logged in>' OR
ParentId in (SELECT ParentId FROM EntitySubscription WHERE SubscriberId = '<USERID that is logged in>' LIMIT 1000) OR
ParentId in (SELECT CollaborationGroupId FROM CollaborationGroupMember WHERE MemberId = '<USERID that is logged in>'))  order by CreatedDate DESC
      
Please note the that I could not write the subquery with “OR” statement directly as shown above because it gave me some error so I looped “EntitySubscription” and “CollaborationGroupMember” separately and just added the Ids in query.
I am not sure if this is the correct way to fetch everything from chatter feeds that are shown in “What I follow”. Can you please confirm if this is the correct way or is there some other object which will directly give me feeds.

2.       Another issue is with feeds with Type=”TrackedChange”. This includes the files that user is following. Suppose if there is any change in the file I see the following msg in SF chatter “Chocolate Price List 7-18-2014 — Beth Beasley uploaded a new version of this file.”. But when I access via the API I don’t get this description in “FeedItem.Body”. I tried other properties of FeedItem also, but I could not get this description anywhere. I even tried to loop the records in FeedItem. FeedTrackedChanges but could not get the description anywhere. Can you help me where I can get this?


3.       The FeedItem query above runs well for a user with admin permissions in SF. But when I run the same query for non-admin user, it gives me the following error “MALFORMED_QUERY: Implementation restriction: FeedItem requires a filter by Id”. I am sure this is because of some permission in SF that we need to grant the user so that FeedItems can be fetched via API, because its running for admin user. And even the error suggests that some RIGHT is missing.
Can you guide what RIGHT I need to assign to the user in SF so that I can fetch all Feeds from chatter?
Amit Dubey 5Amit Dubey 5
Hi I am facing the same issue. Using admin it was running fine but now i am getting the error.
Madhav GoyalMadhav Goyal
Hi,

Is there any solution, I am still facing the issue.

Here is the query I am using:
SELECT Id, createdById,parent.type FROM FeedItem WHERE createdById IN : <User Id Set> AND <Additional Checks>

Thanks,
Madhav G.