You need to sign in to do that
Don't have an account?

ViewState limit exceeded error
Hello. I have this piece of code where I am searching through a web service callout some objects. I want to import to salesforce multiple results at a time and I am saving them in a Map<key, myObject>.
After adding over 100 objects to the map i get the viewstate limit error and I am not showing this map in the vf page. I am using it in the controller to store my objects before the import process.
Any suggestions how could i solve this?
May be what you could do here is create a custom object where you can store the response of your webservice. Later on schedule a batch job which will query the custom object and then parse the response stored in your custom object. This way you might be able to overcome the script statements limit to certain extent. Also by this way you need not worry of the view state, since you wont be having a vf page while the batch runs.
Thanks,
Shailesh.
All Answers
This is the best link .Where you can get solution for your problem .
http://wiki.developerforce.com/page/An_Introduction_to_Visualforce_View_State
Please tick the Answer if Your isue is resolved
Not very helpful. I get what the view state limit is. My variables take like 6KB and my map takes the rest. Reducing the view state for the other variables doesn't help me.
I needed a solution for my problem. I need to import a large number of records at a time and the Map where i keep them exceedes the limit. I was asking for a solution if someone else had the problem.
Hi,
As per my understanding, you are making a webservice callout and based on the response, you are parsing the response to get some data and storing it into a map.
Now if i am correct, one questioin here is, is this the only purpose of your page? If yes, then probably defining the map as transient might help.
Thanks,
Shailesh.
Problem is I am getting data with a limit from the webservice that's why I am adding them to a map which later i use to import into accounts,contacts and so on.
If I try getting them from the webservice at a time i get into the script statements limit error because of the parsing of the xml.
May be what you could do here is create a custom object where you can store the response of your webservice. Later on schedule a batch job which will query the custom object and then parse the response stored in your custom object. This way you might be able to overcome the script statements limit to certain extent. Also by this way you need not worry of the view state, since you wont be having a vf page while the batch runs.
Thanks,
Shailesh.