+ Start a Discussion
Andrei KuznetsovAndrei Kuznetsov 

Investigating why Saving VF page is slow.

Hello Salesforce.com professionals!

I've run into the following situation and need some help in investigation. I have VF page, which consist of tabs. Let's call this page 'MainPage'. Each tab is VF Component.

    <apex:tabPanel switchType="client" value="{!selectedTab}" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" >       
        <apex:tab label="{!dealObjectLabel} Details" name="DealDetails" id="tabOne">
            <c:DealDetails value="{!deal}" parentController="{!parentControl}"/>
        <apex:tab label="Team Members" name="DealTeamMembers" id="tabTwo" disabled="{!dtmDisabled}">
            <c:DealTeamMembers value="{!deal}" parentController="{!parentControl}"/>
        <apex:tab label="Products" name="DealProducts" id="tabThree" disabled="{!dpDisabled}">
            <c:DealProducts value="{!deal}" parentController="{!parentControl}"/>
        <apex:tab label="Contacts" name="DealContacts" id="tabFour" disabled="{!dcDisabled}">
            <c:DealContacts value="{!deal}" parentController="{!parentControl}"/>
Each VF component has its own controller, and it's own custom Save() function. Each VF component calls that corresponding Save() function using jscript. Exaple of Save() function on DealDetails component:

        function saveDetail()

            <apex:actionFunction name="commitSave_D" action="{!doSave}" reRender="ownerSecID,pbs1,pbsNotes,generalerrors" >
                <apex:param name="y_Detail" value="y_Detail" assignTo="{!isFromParent_Detail}" />
There is 'Save and Close' button on the 'MaingPage', which will call its own Save jscript function. This jscript function calls Save jscript functioin on each individual component.
******************************************** Save function on MainPage ************************************
        function saveAllComponents()
            if (!isCurrentlySaving)
                isCurrentlySaving = true;
                errorMessages = "";
                isSavingAll = true;
The problem that customer has is ocassional hanging up and timing out of the 'MainPage' when they click on 'Save and Close' button. The question is if it's possible that calling having Saving code in mulitples components and controllers can cause this type of slowdown? Will it be significantly faster if entire Saving code was called from the MainPage?

Hi Andrei,

Add apex:pageMessages into vf page and reRender every time tab is selected. I hope this would help.
<apex:outputPanel id="pageMsgs">
                <apex:pageMessages ></apex:pageMessages>