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
Marcio Zima.ax1538Marcio Zima.ax1538 

"SOQL statements can not be longer than 10000 characters"

I have one visualforce page that will display more than 500 fields. When it has around 400 fields it was working well.

But as I include more fields it returned the following error: "SOQL statements can not be longer than 10000 characters".

 

I tried to insert a visualforce page into another page and it returned the same error.

 

Are there some way to do it work? Many fields in the same visualforce page without problems with SOQL?

Best Answer chosen by Admin (Salesforce Developers) 
kiranmutturukiranmutturu
we don't..but still you can raise a case to salesforce to increase the same for 20,000 chars....that is one possible solution

in other case if you have 500 fields split it in 2 queries like 300 and 200 fields in 2 queries and then merge using custom logic...

All Answers

kiranmutturukiranmutturu
its not the page error salesforce set a limit in the number of characters in SOQL query ..thats the issue...see the last section in the below link
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm
Marcio Zima.ax1538Marcio Zima.ax1538

Excuse my misunderstanding. Do you know if there is a alternative to it?

kiranmutturukiranmutturu
we don't..but still you can raise a case to salesforce to increase the same for 20,000 chars....that is one possible solution

in other case if you have 500 fields split it in 2 queries like 300 and 200 fields in 2 queries and then merge using custom logic...
This was selected as the best answer
Ankit AroraAnkit Arora
Have you tried going with dynamic query (rather using direct query)? AM not sure if we've limit over there.