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
raseshtcsraseshtcs 

View State Error Visual force page

Hey I am facing a view state error. I checked in the view state option and it shows that the query which i use returns around 2500 records which jump the limit of 135 Kb. are there any workarounds other that putting a limit on the query.

Best Answer chosen by Admin (Salesforce Developers) 
spraetzspraetz

Investigate the transient keyword.

 

Also, are you realy going to display all 2500 of those records on your page at once?

 

I wouldn't recommend that, so if you're using some form of pagination etc, you can simply query the IDs to get yoru working set, and when you go to display the subset of actual records, you can re-query to hydrate the objects.

All Answers

spraetzspraetz

Investigate the transient keyword.

 

Also, are you realy going to display all 2500 of those records on your page at once?

 

I wouldn't recommend that, so if you're using some form of pagination etc, you can simply query the IDs to get yoru working set, and when you go to display the subset of actual records, you can re-query to hydrate the objects.

This was selected as the best answer
charliemanicharliemani

Hi,

 

Iam facing view state error issue. I do implement pagination using ObjectPaginatorListener in Sandbox. So when I make the pagination and list record as "Transient", Issue is solved but Navigation fails as Pagination is nullified.

 

Could you please help me.

 

Regards,

Manikandan