Loading

Document upload error 'Maximum view state size limit (170KB) exceeded'

Julkaisupäivä: May 15, 2026
Kuvaus

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.

Ratkaisu

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:

  • Optimize your SOQL queries: If a large percentage of your view state comes from objects used in your Apex controller or controller extensions, refine your SOQL calls to return only the fields and records needed by the Visualforce page.
  • Reduce the component tree: If your view state is inflated by a large number of Visualforce components, reduce the number of components the page depends on.
  • Use transient variables: Mark variables in your Apex controller as 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.

Knowledge-artikkelin numero

000384993

 
Ladataan
Salesforce Help | Article