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
mworldmworld 

StandardSetController class getFilterId and setFilterId

The StandardSetController APEX class has getFilterId and setFilterId methods. My question is what are these filters and where are they found? How are they used? There is no filter object or any other reference in APEX or VF that I can find.

 

Mauricio Parra

Ron HessRon Hess

These filter id's are the id of List Views in the app.

 

you can create a new list view ( for the same object), then snag the ID from the url of that list view and use it in your filterId.

 

list views are not otherwise exposed in the API

jackpushpanjackpushpan
Is there a way to get only the fields available in the ListViewItem applied via setFilterID?
My code is below:
setCon.setFilterId('<ListViewItemID>');    

List<SOBJECT> objResults = setCon.getRecords();

 

At the moment objResults returns all the fields available in the setcontroller.
NOTE: I intialise my setcontroller with SOQL statement which contains all the fileds available in the custom object. I doing this because I  can use the same controller for different list view item selections.

 

Thanks in advance,

jack

talgiladitalgiladi

Hi,

I didn't get your suggestion...

Is there a way to pass the id of a view (contacts for example) and get the filtered results?

I know the Id of one of the contacts view (like 00BA0000002ly8SaAQ) and want to pass it to a custom web service method and get in return the contacts in this view.

 

Thanks!