This article explains why you see the error "Maximum view state size limit (170KB) exceeded" when uploading a document or performing an action on a Visualforce page in Salesforce.
The Visualforce view state holds serialized data about the current state of a page, including component values, field values, and controller data. Salesforce enforces a maximum view state size of 170KB. When this limit is exceeded, the page action or upload fails with this error.
o resolve the 170KB view state limit error, minimize the amount of data stored in your Visualforce page's view state.
The View State tab in the Salesforce Developer Mode toolbar shows which elements are consuming view state space and how much each contributes. A smaller view state generally results in faster page load times.
Steps to reduce your view state size:
transient if they do not need to persist across requests. Transient variables are not included in the view state.For more information on analyzing view state, see About the View State Tab.
000384993

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.