I have a page where I am trying to show which ListViews a Project is in. I can get the data I want in the Developer Console by querying ListView. However, when I try to import the following query to my code I get the following exception: "Save error: sObject type 'ListView' is not supported." Query:

SELECT Id, Name FROM ListView WHERE SObjectType = 'Project__c'

As a workaround, I am trying to instantiate an Apex:StandardSetController for Project__c and call getListViewOptions(). Notice I am not calling getListViewOptions on my ApexPages.StandardController. The relevant bit that is not working:

public MyExtension(ApexPages.StandardController notUsed)
    debugListViews(); // yields bogus results
public MyExtension(ApexPages.StandardSetController notUsed)
    debugListViews(); // yields valid results
private void debugListViews()
    ApexPages.StandardSetController controller = new ApexPages.StandardSetController([
        SELECT Id FROM Project__c LIMIT 1
    for (SelectOption option : controller.getListViewOptions())

This code works perfectly in Execute Anonymous. I see a list of SelectOption each of which has a valid Name/Id combination. However, when I run this code in my extension's constructor that takes in an ApexPages.StandardController, I get only one SelectOption that is clearly bogus. The Name is "All" and the Id is "000000000000000AAA". Note: the key prefix for ListView is "00B."

To add to the mystery, this code also works as expected in my extension constructor that takes in an ApexPages.StandardSetController.

This seems like it is a Salesforce bug, but I am not allowed to submit a Development Case for this org. Has anyone run into this before and found a workaround?

  • That's interesting. I'm going to try and replicate tonight. I've never seen it do that before...
    – sfdcfox
    Jan 22, 2015 at 0:46
  • Interesting indeed. I am perplexed.
    – Adrian Larson
    Jan 22, 2015 at 0:54

1 Answer 1


I was able to open a case and here comes the answer straight from support:

The issue is if you have id parameter in your URL, getListOptions will not work. If we remove the id parameter the from the URL the page will get the values. We are checking that whether this is Working as Designed or not.

I changed the parameter name to ProjectId and, lo and behold, it works now. Go figure.

You must log in to answer this question.

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