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

SOQL error when saving a VisualForce page

I'm developing a very large visualforce pageset.  The main page has a tabPanel and a bunch of tabs, but when I try to add the last tab - each tab includes a VisualForce page - I get this error:

Save error: SOQL statements can not be longer than 10000 characters

I'm aware of the SOQL limitation, but I'm not doing any SOQL whatsoever.  It's just VisualForce, a few AJAX calls, that's it.  And I don't get this error while using the page, only when trying to save it in the Eclipse IDE or in the SalesForce Develop -> Pages area. 

Is there any way to get information on how many characters over 10,000 I am?  Is it counting all the characters in the VisualForce pages? 

I did a character count on the src/pages directory and there are more than 250,000 characters total, and 10,290 'words'.  Does anybody know how this works under the hood and what I need to do to avoid it? 

Are you using the standard controller in your page (e.g. <apex:page standardController="Account">)? The standard controller generates SOQL queries based on the {!} expressions in your page.
Thanks Doug, that was a great tip.  I arranged things so I didn't need a controller or extension in the page which includes all the others and removed it from <apex:page > at that level.  At first it seemed to have fixed the problem but in fact...I think the issue here was that I had defined too many fields within the scope of the main VisualForce page, so the controller was unable to construct a query (save, upsert, etc) without exceeding 10,000 characters. 

In case anyone else sees this it seemed to balk around 400 fields of a variety of types.  I didn't track this down to the query level, though.

Message Edited by ehrenfoss on 11-25-2008 09:59 PM
You should be able to break things up into a few custom components to avoid the 10K SOQL limit - does mean you'll need to write some apex code of course.