I am new to SFDC and have only been developing for about 6 months, in this time I have noticed some limitations around List Controllers and some standard objects.

Is there any way (programatically) that I could find which Objects cannot be instantiated with a List Controller?


You cannot detect these failures in a safe manner purely in Apex Code. Attempting to give a StandardSetController an unsupported type causes an immediate halt of the program. Even using a try-catch block will result in the same immediate failure, even if the list is determined dynamically using a query string (e.g. Database.query). I suppose you could get a global describe of all SObjects in your organization, then query them 100 at a time using Visualforce remoting, catching those exceptions client-side and generating a list. However, I daresay that such a program would probably take a while to run.

As Itai's answer points out, however, you do know the list of standard supported types; if it's not in the documentation, you should presume it is not supported, even if your code seems to work with that type. Custom objects that use "__c" as the suffix should all be safe, as well as the standard objects listed. Other types of related metadata, like "__Share" are also not supported.

All that said, you can choose to use your own custom pagination. It's not as handy as using a StandardSetController, because each time you query the database, you might get a different subset as records are added/removed from the database.

If you absolutely need up to 10,000 records in a list using pagination for an unsupported type, consider querying all of the records to the page using the QueryResultIterator, and then rolling your own JavaScript-based pagination, or using some jQuery pagination module, or some other code you could find by using a query.

|improve this answer|||||

According to this page (Standard List Controllers), the following standard objects are supported :














|improve this answer|||||
  • 1
    This answer doesn't really answer how to use objects that are not supported, though. – sfdcfox Sep 4 '16 at 15:05
  • I agree with @sfdcfox , thanks for taking the time to try and help though. – Tiaan Swart Sep 7 '16 at 2:27

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.