Home What is View state and How to enable view state in Salesforce

View State:

The view state of a web page is composed of all the data that’s necessary to maintain the state of the controller during server requests (like sending or receiving data). Since the view state contributes to the overall size of your page, performance of a page can depend on efficiently managing the view state. The View State tab in the development mode footer provides information about the view state of your Visualforce page as it interacts with Salesforce.

Important Points:
Minimize number of form on a page. Use apex:actionRegion instead of submitting enter page or using multiple forms.
Refine your SOQL to only retrieve the data needed by the page.
All public and private data members present in Standard, Custom and Controller extensions are saved.
The transient variables are not passed to view state and therefore not stored in View State.

How to enable view state in Salesforce
1. Go to setup –> Administration Setup –> Manage Users –> Users.
2. Select the user.
3. Click ‘Edit’ button.
4. Check the ‘Show View State in Development Mode’ checkbox.
5. Click ‘Save’ button.

Leave a Comment