Maximum view state size limit exceeded

I have a Skuid page I am using with Salesforce where I’m doing a csv file upload then comparing Opportunities and updating fields on the Opportunity (i.e. dates, stage, etc).  The file has grown and now I am getting the error:  “Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 157.109KB” when try to upload a document.

There is a writeup on what needs to be done to fix it but I believe this is something Skuid would need to do on the platform (

Has anyone come across this and/or is there a fix that’s known to resolve this issue?

Thank you!

I’m fairly certain you need to set the “readonly” attribute on their Visualforce page to true, like we do in basically every example on this page in our documentation.

Also, here’s the applicable Salesforce documentation, which actually explains what that property does. I believe you might want to reach out to your salesforce admin for more questions.

Stephen… that doesn’t seem to work. Below is the very simple code that is being used and I still get the error after adding the Readonly piece.


I also thought it may be due to the number of blank lines (there is a blank line between each row in the csv) and I took those out but increased the number of rows to about 5,000 and now I am getting the following error...

Apex CPU time limit exceeded
Error is in expression '{!validateFile}' in component  in page skuid:import: (skuid)

We (OpenGate) are a partner of yours (Skuid) so I don't see a need to get my Salesforce Admin involved.  I have already had this issue looked at by our developers here and I was hoping this was something you could help me with.

Please advise on what you recommend to try next.

I’m sorry. Have you tried readOnly ? It is case sensitive.

That doesn’t fix the problem.  Same error.

It seems when I cut down on the blank lines between the records and keep the number of lines (records) that I am uploading down around 2300 it works fine.  Seems like a small number to me though.  I would assume we could get more in there than that.

Any thoughts on the link I sent in my first request above?

Any other help would be greatly appreciated.

Hey Ali,
1. Error 1, ‘Maximum view state size limit (135KB) exceeded’ was resolved by putting the page into readOnly mode
2. Error 2, ‘Apex CPU time limit exceeded’ is a different limit that indicates it took longer to process the rows than Salesforce allows for processing (, and Salesforce canceled the process
Reducing the number of rows in a single import will help with error 2, but we recognize it’s not ideal. Have you considered the Salesforce Data Import Wizard ( It has seen a lot of improvements since we originally built the Skuid importer tool.

Error 1 was not resolved when I put the page in readOnly mode.  Error 1 was resolved when I took out records to reduce the import regardless of the readOnly parameter.

Is there anything we can do to prevent the Error 1 as the import file grows?