2

I get an error message when I try to do a Javascript Remote soql query on FeedItems through "sites". It works perfect when I do this within salesforce with a standard user but it doesn't work through "sites" with public access.

Error Message: Visualforce Remoting Exception: Implementation restriction: FeedItem requires a filter by Id FeedItem requires a filter by Id

This is the Remote Function which I use:

@RemoteAction       
public static List<FeedItem> getFIexternal(String quId) {
    List<FeedItem>               FIApp = new List<FeedItem>();
    List<QO_ApprovalLineItem__c> AppLi = new List<QO_ApprovalLineItem__c>();
    AppLi = [select id from QO_ApprovalLineItem__c where Quote__c =: quId];
    if(AppLi.size() > 0){
        FIApp   = [
            select Body, CreatedDate, InsertedById, InsertedBy.name 
            from FeedItem 
            where ParentId =: AppLi[0].Id order by CreatedDate desc limit 100
        ];
    }
    return  FIApp;
}

3 Answers 3

1

it is possible to do the soql query on FeedItem without javascript remoting. I can use on the visualforce page to create the table.

this works with a salesforce user and with public access through "sites"

1

The issue here is you need an admin user with View All Data (VAD) or Modify All Data (MAD) access. In the documentation about feedItem towards the bottom under Usage it says you need "View All Data" access to do these types of queries.

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

If you are trying to get the record feed you should just request the feed instead of asking for the feed items parented by the record.

We don't recommend getting the feed via SObject, instead you should use Chatter REST API or Connect in Apex.

If you really want to use SObject here is some information on getting the Account Feed and Collaboration Group Feed. https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_list.htm

1

I had to specify without sharing in my controller extension in order to have get around the 'FeedItem requires a filter by Id' error on a visualforce page.

I believe it was only impacting users without modify all data as it was working fine for Admins.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .