How to minimize the view state of the custom visual force page. I have a custom VF page where I have a map that contains the list of sObject names. I need to make it available on the VF page to access it via javascript Remoting, thus, can't make it transient. However, it causes the viewstate to increase if you open a page in any org that has many objects.

1 Answer 1


You can add a static @RemoteAction method to your controller that builds the list of object names when it is called. If parameters are required to build that list you must pass them in the JavaScript call.

This approach has these advantages:

  • Keeps that data out of the view state
  • Avoids the time delay caused by transferring the view state when the method is invoked using apex:actionFunction

(You could instead render the data as JSON into the page and do whatever processing you require purely at the client-side in JavaScript which would avoid the server-round trip entirely. But that would only make sense if the majority of the data is typically used.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .