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
tengeltengel 

Filter FeedItem...no useful fields to query

I desperately need to filter FeedItems where Type = 'ContentPost' and at least one of the following fields is LIKE '%Commission Report%', but they all appear to be unsupported in a query call: Body, ContentDescription, ContentFileName, Title. It looks like querying Description and Name is supported in Attachment, why can't I query anything useful related to a FeedItem?

 

Can anyone offer a suggestion on how to go about doing this? Here is my extension:

 

public with sharing class pcrControllerExtension {
private final id pdcid;
public pcrControllerExtension(ApexPages.StandardController stdController) {
pdcid = ((Producer_Document_Center__c)stdController.getRecord()).id;
}

public String getFileList() {
    String strHTMLTable = '<table>';
    Integer i = 1;
        for(FeedItem fi:[Select Id, Body, Title, RelatedRecordId FROM FeedItem
        WHERE ParentId =:pdcid AND Type = 'ContentPost' AND ContentFileName LIKE '%Commission Report%' Order By CreatedDate Desc])
        {
            strHTMLTable = strHTMLTable + '<tr><td>No.' + i + ' </td><td><a href="' + URL.getSalesforceBaseUrl().toExternalForm()+ '/' + fi.RelatedRecordId + '" target="_blank" >' + fi.Title+ '</a></td></tr><BR>';
            i++;
        }
    strHTMLTable = strHTMLTable + '</table>';
    return strHTMLTable;
    }
}

 

Best Answer chosen by Admin (Salesforce Developers) 
Vinita_SFDCVinita_SFDC

Hello,

You can filter on field "Type" but "ContentFileName" field can not be filtered and this is as per design. The "filterable" access property of field in schema browser (Force.com IDE etc). This property indicates whether the field is filterable (true) or not (false). If true, then this field can be specified in the WHERE clause of a query string in a query() call.

If you wish to filter on Body, ContentDescription and ContentFileName, i would suggest you to post an idea with business case on ideaexchenge: success.salesforce.com/ideaSearch