6

I have a Visualforce page using a Standard Set Controller, and I'm trying to set the filter ID without using an element on the page and without using a customer controller or extension.

Based on an answer to this post it should be possible by using filterId={a ListView ID} in the URL, however this doesn't seem to work for me. Has this feature been depreciated (as I can't find any reference to it in any documentation), or has the parameter name changed?

I've also tried using apex:variable and apex:param, but neither of those worked.

SSCCE:

AccountSetPage.page

<apex:page standardController="Account" recordSetVar="Accounts">
    <apex:repeat value="{!Accounts}" var="a">
        {!a.Name}
        <br/>
    </apex:repeat>
</apex:page>

Then visiting https://c.eu2.visual.force.com/apex/AccountSetPage?filterId={filterId} displays all Accounts, rather than the selected List View (which 100% does not include all Accounts, I've triple checked that).

  • Its working for me.I have replaced the filter id with the id of the list view and accounts are displaying.But max of 20 accounts will display. – sfdc Mar 25 '14 at 17:58
  • @sf.dev Had you already set the List View to the one you wanted on the Accounts tab? The Standard Set Controller uses the last used List View by default (filter id should override this). If after changing to another view filter id is still working - How did you get the filter id? Was the list view a custom one or a built in one? Perhaps I'm using the wrong id, or an invalid one. I used one of the ids that was returned from an apex:repeat on {!listviewoptions}. – Alex Tennant Mar 25 '14 at 18:38
  • @AlexTennant try using c.eu2.visual.force.com/apex/AccountSetPage?fcf={filterId}. I get the filter id by going to the list view on the object i.e. domain.salesforce.com/001?fcf=00Bd00000039Xh6 – Mark Masterson Mar 25 '14 at 21:04
  • @MarkMasterson Switching to using fcf for the parameter name seems to work with no side effects as far as I can see. Write it up as an answer and I'll accept it. Thanks. – Alex Tennant Mar 26 '14 at 9:19
8

It appears that the parameter was renamed to fcf at some point (or at least, using fcf as the parameter works when filterId is not always working in my experience). As this isn't documented anywhere, I don't know how supported it will be, but there does not appear to be an alternative (that I know of) at this point to set the filter on a StandardSetController without using an extension or controller.

You can set this parameter by specifying domain.salesforce.com/apex/{StandardSetControllerPage}?fcf={filterId} in the url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.