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
Gaurav Srivastava_SDFCGaurav Srivastava_SDFC 

Weird Salesforce Error

Hi All,
Just got view state issue while "Compile all classes" from the salesforce 'Apex Classes'. Couldn't understand from where VF page is taken into account.

Please check the screenshot below :


User-added image
Ashish_SFDCAshish_SFDC
Hi , 


This is a standard error, 

This usually means that the data in the form is exceeding the limit which is generally high as the limit for values is 135kb. 

See the links below for more information and best practices for resolving this error. 

1. Remove  unnecessary data members from the controller class and try to suffice them by using local variables. Consider using transient variables etc. In your code I see fileBody as a Blob variable as a data member but only used in one function. Cant this made a local variable?

2. If you are using collection variables such as Lists, sets and Maps as data members. Let these type of variables be loaded with data required at that point of time in page's execution. Clear/nullify these collection variables when they can be.

3. Try not to use too many pageBlocks. Try loading the components of the Page dynamically rather than loading all of them at once. etc.

4. Basically you need to optimize your Logic so that the data transfered between postbacks is only as much as required.

These points have helped me several times to resolve the error... Hope this helps...


http://forceguru.blogspot.in/2010/11/best-practise-to-write-apex.html

http://www.eltoro.it/ArticleViewer?id=a07A000000NPRhPIAX

http://learningthecloudway.blogspot.in/2013/02/how-to-deal-with-error-maximum-view.html


Regards,
Ashish
Gaurav Srivastava_SDFCGaurav Srivastava_SDFC
Hi Ashish,

Thanks for reply. This error I didn't got from my custom VF page. I went to the classes and there i clicked on the standard link 'Compile all classes'. While compiling salesforce thrown this error.  Please suggest if I am missing anything here.

Thanks,
Gaurav


Ashish_SFDCAshish_SFDC

Hi Gaurav,


This can happen when you have a large number of classes in your organization AND there are a signficant number of compilation errors. You have to fix the compilation errors using another tool, such as the Force.com IDE, or correct your compilation errors and try again.

This often happens in code bases that use utility classes, where one or more functions are altered such that they no longer match the signature of the classes that depend on them. You might want to make an "invalid class" list view, try editing each class that is invalid (just edit->save, if there's a problem, fix it and go to the next class).

The Apex Classes page is a Visualforce page, runs on the Visualforce engine, and is subject to the same limitations as normal Visualforce. Having too many compilation errors results in this message.

See the below link for more information, 

https://developer.salesforce.com/forums?id=906F0000000996qIAA


Regards,

Ashish