I'm having an issue using a List to instantiate the StandardSetController and applying a list view filter id.
Here's an example of using a List for instantiation as detailed at http://www.salesforce.com/us/developer/docs/pages/Content/apex_pages_standardsetcontroller.htm
List<Campaign> campaigns = [SELECT Id FROM Campaign LIMIT 10000];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(campaigns);
system.debug('standard set controller count before filter: '+ssc.getResultSize());
ssc.setFilterId('00BU0000002L6POMA0');
system.debug(ssc.getFilterId());
system.debug('standard set controller count after filter: '+ssc.getResultSize());
The result of this is:
18:12:09:176 USER_DEBUG [17]|DEBUG|standard set controller count before filter: 10000
18:12:09:177 USER_DEBUG [19]|DEBUG|00BU0000002L6POMA0
18:12:09:177 USER_DEBUG [20]|DEBUG|standard set controller count after filter: 10000
'00BU0000002L6POMA0' is the id of a valid list view filter that should return two results according to the UI as well as my investigation in the org.
However, the filter is appropriately applied if I use the queryLocator method of instantiation.
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id FROM Campaign LIMIT 10000]));
system.debug('standard set controller count before filter: '+ssc.getResultSize());
ssc.setFilterId('00BU0000002L6POMA0');
system.debug(ssc.getFilterId());
system.debug('standard set controller count after filter: '+ssc.getResultSize());
results in:
18:17:37:233 USER_DEBUG [17]|DEBUG|standard set controller count before filter: 10000
18:17:37:319 USER_DEBUG [19]|DEBUG|00BU0000002L6POMA0
18:17:37:319 USER_DEBUG [20]|DEBUG|standard set controller count after filter: 2
Has anyone seen this and overcome it somehow?
The reason I would like to use the List instantiation is that it gets me around the nasty "Too many query locator rows: 10001" when I loop the StandardSetController instantiation a couple times to boost the # of records I can filter and return.