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
Cable Guy.ax375Cable Guy.ax375 

Maximum view state size limit (128KB) exceeded. Actual view state size for this page was 128.906KB

Can anyone point out where I can reduce the state size in my code:

 

 

<apex:page standardController="Forecast__c" extensions="EditForecastContExt" id="wfPage" sidebar="false" tabStyle="Forecasts__tab" action="{!creatManagerOwnerWrappers}">
    <apex:form >
        <apex:sectionHeader title="{!user.Name}'s Forecast" id="header" />
        <apex:commandLink action="{!returnToForecast}" value="Back to Forecast"/>
        <apex:actionStatus id="loadingStatus" onStart="showStatus();" onStop="hideStatus();"/>
        <apex:outputPanel id="oppPanel">
            <div id="oppFiltersDiv">
              
                <span class="filterLabel">Filter By User:&nbsp;&nbsp;</span>
                <apex:selectList size="1" value="{!forecastUser.oppFilterUserId}">
                    <apex:selectOptions value="{!opportunityManagerUserFilter}" />
                    <apex:actionSupport event="onchange"
                        action="{!forecastUser.filterManagerOpportunities}"
                        status="loadingStatus" rerender="oppPanel,msgs" />
                </apex:selectList>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <span class="filterLabel">Filter By Director&#39;s Category:&nbsp;&nbsp;</span>
                <apex:selectList size="1" value="{!forecastUser.oppFilterCategory}">
                    <apex:selectOptions value="{!opportunityCategoryFilter}" />
                    <apex:actionSupport event="onchange"
                        action="{!forecastUser.filterManagerOpportunities}"
                        status="loadingStatus" rerender="oppPanel,msgs" />
                </apex:selectList>
                 
            </div>
            <br/>
            <apex:pageBlock mode="edit">
                <apex:pageBlockTable value="{!forecastUser.managerOWrappersFiltered}" var="o" id="oppTable">
                    <apex:column headerValue="Sales Rep">
                        <apex:outputField value="{!o.managerOwners.Sales_Rep__c}" />
                    </apex:column>
                  
                    <apex:column headerValue="Opportunity Name">
                        <apex:outputLink value="/{!o.managerOwners.Opportunity__r.Id}">{!o.managerOwners.Opportunity__r.Name}</apex:outputLink>
                    </apex:column>
                 
                 
                    <apex:column headerValue="{!$ObjectType.Opportunity.Fields.CloseDate.Label}">
                        <apex:inputField value="{!o.managerOwners.Opportunity__r.CloseDate}" >
                            <apex:actionSupport event="onchange" rerender="changed">
                                <apex:param name="changeParam"
                                            assignTo="{!o.IsChanged}"
                                            value="true" />
                            </apex:actionSupport>
                        </apex:inputField>                  
                    </apex:column>
                    <apex:column headerValue="ESP">
                        <apex:outputField value="{!o.managerOwners.ESP__c}"/><br/>
                    </apex:column>
                   
                    <apex:column headerValue="Split Amount">
                        <apex:outputField value="{!o.managerOwners.Split_Amount__c}"/><br/>
                    </apex:column>
                 
                    
                    <apex:column headerValue="Ready To Update">
                        <apex:outputPanel id="changed">
                            <apex:image value="{!$Resource.check}" rendered="{!o.IsChanged}" height="15px" width="15px" id="check"/>
                            <apex:image value="{!$Resource.xmark}" rendered="{!NOT(o.IsChanged)}" height="15px" width="15px" id="x"/>
                        </apex:outputPanel>
                         <br/>
                    </apex:column>
                    
                    
                </apex:pageBlockTable>
                 
                 
                <apex:pageBlock >
                <apex:outputPanel id="totalPanel">
                    <table style="width: 100%">
                         
                        <tr>
                            <td width = "75%"></td>
                            <td class="numericalColumn"></td>
                            <td>Total ESP: ${!forecastUser.totalESP}</td>
                            <td>Total Split Amount: ${!forecastUser.totalSplitAmount}</td>
                        </tr>
                    </table>
                </apex:outputPanel>
            </apex:pageBlock>
                  
               
                <apex:pageblockButtons location="bottom">
                    <apex:commandButton action="{!forecastUser.updateOpps}" value="Update Opportunity" status="loadingStatus"
                                        rerender="oppPanel, msgs"  rendered="{!OR(hasPermission, $User.Id == forecastUser.manager.Id)}"/>
                </apex:pageblockButtons>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
    <apex:pageMessages id="msgs"/>
    <apex:outputPanel id="popup">
    <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
        <apex:outputPanel styleClass="customPopup" layout="block" rendered="{!displayPopUp}">
            <div style="text-align:center; font-size: 1.5em; font-weight: bold; vertical-align:middle">
                LOADING <apex:image value="{!$Resource.AjaxLoader}" style="margin-left:15px" />
            </div>
        </apex:outputPanel>
    </apex:outputPanel>            
</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

We faced similiar type of problem in one of the code in which we were trying to upload a file using <apex:inputfile>. The error was rectified by using transient keyword assigned to filebody and filename.

 

Hope this helps.