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
Tushar SethTushar Seth 

ViewState Problem in Salesforce Production

Please let me know how to solve ViewState Problem.....

 

In Sandbox:

Now I can able to create and send Email with attachment ....

And Whole functionality is going good in sandbox wheater I upload file of 200kb or 10kb.....

 

In Production

When  I am uploading file of below 135 kb it is working fine.....

but when I am exceeding from 135kb,  ViewState error is encountered in VisualForce page...by showing 

Error : Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 410.891KB.  

 

does anybody have any idea how to get rid of this problem...???

Ankit AroraAnkit Arora
Tushar SethTushar Seth

Thanks buddy your blog is good .....

 

but that wouldn't work on my problem ......

 

But I got the solution.... 

Ankit AroraAnkit Arora

Please share with us the solution.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Tushar SethTushar Seth

hii buddy

I don't want to upload file more than 50 kb but if the user delibrately upload the file in that page it was displaying that Error

 

So What I did as an Alternative Option..is as we have 

Attachment object  and in that there is a filed  body of datatype base64 so we can make it null as it goes over our limit of File 

 

Attachment desktopattachment = new Attachment();

// In Validation Block

desktopAttachment.Body = null; // Delibrately : If you exceed by 135kb 

Ankit AroraAnkit Arora

So basically making object instance , variables and properties null solves your problem. Hope my blog helped you somehow.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

ritharitha

Great solution. Thank you very much