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
BenBelBenBel 

StandardSetController hits govenor limit

 I have written some code that uses a StandardSetController and it works fine untilthe number of record exceeds 10,000, at which point I hit a govenor limit

 

using ctl.SetFilterId(...) generates this error

 

Account ORDER BY Name ASC limit 10000 USING Mru ^ ERROR at Row:1:Column:68 unexpected token: USING


There seems to be a problem applying the filter to the query and I cant see a way to examine a filter within Apex Code

 

any help out there?

mtbclimbermtbclimber
Is the StandardSetController bound to your page or are you instantiating it in Apex?
CarlBCarlB

It is done through Apex code, within a custom controller class.

 

    String query = 'SELECT NAME FROM ACCOUNT';
    ApexPages.StandardSetController ctl = new ApexPages.StandardSetController(Database.getQueryLocator(query));

 

This works fine, until the number of accounts exceeds 10000, at which point I reach a govenor limit.  I amended by code, thus:

    String query = 'SELECT NAME FROM ACCOUNT LIMIT 10000';
    ApexPages.StandardSetController ctl = new ApexPages.StandardSetController(Database.getQueryLocator(query));

 

However, I have a problem if I try to use ctl.setFilterId(...), as it generates an error:

    Account ORDER BY Name ASC limit 10000 USING Mru ^ ERROR at Row:1:Column:68 unexpected token: USING

It appears that there is a bug in your application when applying the filter to the query, and I can't see any way around it as there is no way to examine a filter within Apex code to manually generate the correct query.
 

mtbclimbermtbclimber

Yes, I was going to ask you to apply the limit yourself in your implementation as a possible workaround. Either way, please log a case with support on this. The query we are generating is malformed.

 

Thanks,

CarlBCarlB

Funnily enough, I had already opened a case (03305822) and the response I got was "For Developer Support, you will need to go to our Developer Support community."

 

 

Any idea how to get someone to actually take a look at the case, rather than just referring me to this forum?

 

mtbclimbermtbclimber
Sorry about that. I will re-open it for you and get it assigned.
TexanTexan

I'm having the exact same problem. Is there a resolution to this piece. Anyway, I can track what is the status for the case that was opened?