+ Start a Discussion

Maximum view state size limit (128K) exceeded. Actual viewstate size for this page was 180K

We had develop a page in visulaforce, this do a filter Accounts crossing with other objects. This page is for one client, they have arround 600.000 records in the Account Table, we have controled the limits governors but the result of a normal filter will can return more than 8000 records. We try to show the result with a component that paginates all the records but when the result have more than 1200 records aprox visualforce gives us this error:


Maximum view state size limit (128K) exceeded. Actual viewstate size for this page was  131,375K.


How can we control this limit to show a custom message or how we can do to show all the records?


thanks for all.

We are having a similar issue.


Our use case is that we are querying a set of Contacts that are then displayed on a VF page and available for selection for addition to a Campaign.  Our queries could return up to 10k Contacts (we ensure no more than that are returned), and we are displaying the results in a data table that is broken down into page results of 100.  See example below.


We really need to be able to pass all of the results to the page because we have enabled the user to "Select all Contacts", which would allow them to add all query results to the Campaign without having to click through each page. Since running into this issue, we have evaluated which data we can make transient, but the data that is causing the issue (the Contact set) cannot be made transient.


So my question is, how would you suggest overcoming this issue?  Since I'm sure there is no way around the view state limit, is there a better architechture or design that you could suggest that would accomplish the same thing with no adverse impact on the user experience?


Message Edited by infoweldernick on 09-16-2009 08:41 AM
Message Edited by infoweldernick on 09-16-2009 08:42 AM

try using the transient keyword on your visualforce controller to do garbage collection on the controller in memory.