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
Gopi chand 11Gopi chand 11 

Maximum view state size limit (135KB) exceeded How can I avoid this error?

Maximum view state size limit (135KB) exceededHow can I avoid this error? I read similar post without getting any working solutions for me. When I try to upload file larger than about 900KB, I get the error. Please guide me .
charforcecharforce
The View State tab shows you which elements on your page are taking up that space.

In order to avoid this error, minimize your pages view state. You can optimize your Apex controller code and remove any superfluous Visualforce components used.

For example:
If you notice that a large percentage of your view state comes from objects used in controllers or controller extensions, consider refining your SOQL calls to return only data that's relevant to the Visualforce page. If your view state is affected by a large component tree, try reducing the number of components your page depends on.

https://help.salesforce.com/HTViewSolution?id=000002955&language=en_US
ManojjenaManojjena
Hi Gopi ,
Check below link it will help !!
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State

Enable developer mode in your organisation ,Once you will enabe you need to observe what is the source from where you are getting this view state .
You can use transient key word or if not required then you can remove <apex:form > with html form tag .which will not create view state .
Once sending to the broswer if you will clear the list if any then also view stare will reduce .
If any unwanted fields are there in your list once  you will remove then also you can reduce view state .

Check below link for VF page performance .
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_best_practices_performance.htm

Let me know if it helps !!
Thanks 
Manoj
Amit Chaudhary 8Amit Chaudhary 8
Please check below post What is viewState
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State

Best Practices for Optimizing View State
1) Minimize Number of Forms on a Page
2) Declare Variables as Transient to Reduce View State
3) Recreate State versus Storing It in View State
4) Use Custom Objects or Custom Settings to Store Large Quantities of Read-Only Data
5) Refine Your SOQL to Retrieve Only the Data Needed by the Page
6) Refactor Your Pages to Make Its View Stateless

View State Size
The view state size of your Visualforce pages must be under 135 KB. By reducing your view state size, your pages can load quicker and stall less often.You can monitor view state performance through the View State tab in the development mode footer and take the following actions:

1) Use the transient keyword in your Apex controllers for variables that aren’t essential for maintaining state and aren’t necessary during page refreshes.
2) If you notice that a large percentage of your view state comes from objects used in controllers or controller extensions, consider refining your
3) SOQL calls to return only data that's relevant to the Visualforce page.
If your view state is affected by a large component tree, try reducing the number of components your page depends on.
1) http://www.jitendrazaa.com/blog/salesforce/introduction-to-view-state-in-visualforce/
2) http://www.infallibletechie.com/2012/09/view-state-in-salesforce.html
3) http://www.infallibletechie.com/2012/09/how-to-enable-view-state-in-salesforce.html
4) http://sfdcfaq.blogspot.com/2013/04/what-is-visualforce-view-state.html

Please let us know if this will help you

Thanks
Amit Chaudhary
Roberto FainiRoberto Faini
hello
i have a visual force page that show in a google map "the map point" for any product added in Sales Force.
from any days i recive this error when open page, i think because now there are a lot of "map point" (because i added a lot of product) and exceeded size limit, can this be the problem?
can i increase this limit? or there is a work around?
thank you very much!