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
yaramareddy radhikayaramareddy radhika 

What is View State in salesforce? and mention uses of view state?

Arvind KumarArvind Kumar
Hi Radhika,

View State: Visualforce pages that contain a form component also contain an encrypted, hidden form field that encapsulates the view state of the page. This view state is automatically created, and as its name suggests, it holds the state of the page - state that includes the components, field values and controller state.

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

Read the below link for View State more information


If you have any query, let me know.

If it solves your problem mark as a best answer.

Arvind Kumar
Thanks, Nice information.