anusha(salesforce developer)

Saturday 23 July 2016

What is Visualforce view state? what are the best practices to reduce the view state size?

Ans:

A visualforce page that contains 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 page-state that includes the components, field values, and controller state.

The Best Practices are:

 1. Use only one Form tag per page, use apex:actionRegion instead of  using 2 or more forms.
 2. Refine SOQL to only retrieve the data needed by the page
 3. Mark any apex variables that are not necessary to the view state  as Transient.
 4. Use outputLink components instead of commandLinks or  commandButton components where possible as they don't need to be  nested in a form

No comments:

Post a Comment