Contents
How do I stop View State error?
How to reduce View State:
- Use the transient keyword: The simplest and the most logical way is to keep the size of the VF page as small as possible.
- Refine your SOQL: Reduce the number of records displayed on a page by refining SOQL.
What are states in VF?
What is viewState? ViewState holds state of the visualforce page that holds state that includes the fields, components and controller state. Viewstate data in encrypted and cannot be viewed tools like firebug.
How do I view ViewState in Salesforce?
View State Tab
- From your personal settings, enter Advanced User Details in the Quick Find box, then select Advanced User Details. No results?
- Click Edit.
- Select the Development Mode checkbox if it isn’t selected.
- Select the Show View State in Development Mode checkbox.
- Click Save.
Which variables are not transmitted in view state?
Static variables also don’t get transmitted through the view state.
How do I use a view state in a VF page?
There is a limit of 135KB of view state. To maintain state in a Visualforce page, the Force.com platform includes the state of components, field values, and controller state in a hidden form element. This encrypted string is referred to as the view state and has a limit of 135KB.
How do I stop a view state in Salesforce?
In order to reduce the view state, make use of the following:
- “Transient” keyword – to declare instance variables that can’t be saved, and shouldn’t be transmitted as part of the view state for a VF page.
- Minimize the number of forms i.e on a page.
- Refine your SOQL to retrieve only the data needed.
How do I check my view state?
To monitor view state, you must first enable this by going to My Settings | Personal | Advanced User Details and clicking Edit. Select the Development Mode AND Show View State in Development Mode checkboxes and click Save.
What is view state size in Salesforce?
Salesforce allows Visualforce pages to have a maximum view state size of 170KB. The View State tab shows you which elements on your page are taking up that space. A smaller view state size generally means quicker load times. In order to avoid this error, minimize your pages’ view state.