Slaesforce FAQ

how to reduce internal viewstate in salesforce

by Prof. Lois Nitzsche Published 3 years ago Updated 2 years ago
image

To reduce view state: Use filters and pagination to reduce data requiring state. Declare instance variables with a transient keyword when the variable is only useful for the current request.

Full Answer

How to optimize the view state size in Salesforce?

This information can help you in optimizing the view state size. Once enabled, it shows up as a tab in Development Mode, as follows. you can enable that from Edit User-> Select view state checkbox after development mode checkbox.

What is view state in Salesforce soql?

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. View state holds the state of Visual force page.

Why are my view state values private in Salesforce?

define private if they are not used on visualforce page. 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.

What is view state in salesforce development mode footer?

The View State tab in the development mode footer provides information about the view state of your Visualforce page as it interacts with Salesforce. If your not using input tags in visual force page form is not required.Without form Viewstate is not created. Minimize number of form on a page. Use apex:actionRegion instead of using 2 or more forms.

image

What is view state in Salesforce?

View State is a technique Salesforce uses to maintain the current state of the page and the data that was queried between the user requesting things from the server and sending any changes back to the server.If the view state gets too large problems can begin to occur. The view state is an encrypted field that contains the following data: 1 All of the non-transient data that is in the associated controller and any associated controller extensions 2 State related to all of the form elements and components that are used on the page. 3 Finally there’s some sort of internal state that Salesforce doesn’t provide much information about.

Why is view state important?

The reason that the view state is so important is that because every time the page is re-rendered for some reason or that a request has been sent to the server that we need to send and receive the view state. As you can imagine, a large view state being constantly transmitted would add a lot of overhead.

Controller Data - Use transient

To reduce the amount of data needed to store the state of your controller you can make liberal use of the transient keyword so that only data that is truly needed to maintain state is sent over to the client. Anything you can re-query, or otherwise re-create, can be ditched.

Internal View State - Avoid apex components

If you're running into internal view state issues (this typically only happens with pages with large collections), the best way to reduce it is to switch to using standard HTML components instead of apex components. Each apex component adds a certain amount of "weight" to the page (and some much more than others, i.e.

Friday, September 14, 2018

Suppose we are having a requirement to register a user. If we are having multiple pages for user registration which user need to fill, so under this case we need to maintain the state when the user is moving from one page to other (i.e to maintain previous page data). By using form tag inside visualforce page we create view state.

viewstate in salesforce

Suppose we are having a requirement to register a user. If we are having multiple pages for user registration which user need to fill, so under this case we need to maintain the state when the user is moving from one page to other (i.e to maintain previous page data). By using form tag inside visualforce page we create view state.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9