• Mark Dsirl
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I created a visual force page with Account Details at the top and a contact related list at the bottom.  I have Save and Cancel buttons on the page.  The Save button works after I modify a contact but does not save the modification when I change one of the account fields.  Here is my code.

---VF Page---
<apex:page standardController="Account" showHeader="true" sidebar="true" extensions="EditableContactListExtension">
    <apex:form >  
      <apex:pageMessages id="messages"/>
        <apex:pageBlock title="Account Penetration" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
                <apex:commandButton value="Print Profile" action="{!URLFOR($Action.Account.View,Account.Id)}" onclick="openConga()"/>
                <Script Language="JavaScript">function openConga() { window.open('{!URLFOR($Action.Account.Penetration_Profile,Account.Id)}', '','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes, toolbar=no,location=no,status=yes'); }  
                </Script>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Contact Penetration" columns="3">
                <apex:outputField value="{!account.Architect_Contacts__c}"/>
                <apex:outputField value="{!account.Design_Contacts__c}"/>
                <apex:outputField value="{!account.Total_Contacts__c}"/>
                <apex:outputField value="{!account.Architects_Engaged_6_Months__c}"/>
                <apex:outputField value="{!account.Designers_Engaged_6_Months__c}"/>
                <apex:outputField value="{!account.Total_Engaged_6_Months__c}"/>
                <apex:outputField value="{!account.Architect_Penetration__c}"/>
                <apex:outputField value="{!account.Design_Penetration__c}"/>
                <apex:outputField value="{!account.Total_Penetration__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Specification Share of Wallet" columns="2">
                <apex:inputField value="{!account.Total_Annual_Specifications_Number__c}"/>
                <apex:inputField value="{!account.Total_Annual_Specifications_Sales__c}"/>
                <apex:inputField value="{!account.Koroseal_Specs_TTM_Number__c}"/>
                <apex:inputField value="{!account.Koroseal_Specs_TTM_Sales__c}"/>
                <apex:outputField value="{!account.Share_of_Wallet_Number__c}"/>
                <apex:outputField value="{!account.Share_of_Wallet_Sales__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Specification Win Rate" columns="1">
                <apex:outputField value="{!account.Koroseal_Specs_TTM__c}"/>
                <apex:inputField value="{!account.Specifications_Won__c}"/>
                <apex:inputField value="{!account.Specifications_Lost__c}"/>
                <apex:outputField value="{!account.Specification_Win_Rate__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection id="childList" columns="1" title="Known Contacts" collapsible="false">
        	  <!-- There is a trick to creating a counter when rendering rows in a
              pageBlockTable. You have to define a variable to default to 0,
              and then update that variable inside the table row. This is the
              way that I can leverage smart row deletes -->
        <apex:variable var="rowNum" value="{!ZERO}" />
        <apex:outputLabel value="No Contacts currently exist. Click below to Add." rendered="{!NOT(hasChildren)}"/>
        <apex:pageBlockTable value="{!children}" var="contact" rendered="{!hasChildren}" >
          <apex:column headerValue="First Name">
            <apex:inputField value="{!contact.FirstName}" />
          </apex:column>
          <apex:column headerValue="Last Name">
            <apex:inputField value="{!contact.LastName}" />
          </apex:column>
            <!-- Add additional children metadata columns here -->
          <apex:column headerValue="Studio">
            <apex:inputField value="{!contact.Studio__c}" />
          </apex:column>
          <apex:column headerValue="Type">
            <apex:inputField value="{!contact.Type__c}" />
          </apex:column>
          <apex:column headerValue="Preferred Contact Frequency">
            <apex:inputField value="{!contact.Preferred_Contact_Frequency__c}" />
          </apex:column>
          <apex:column headerValue="Date Last Contacted">
            <apex:inputField value="{!contact.Date_Last_Contacted__c}" />
          </apex:column>
          <apex:column headerValue="Days Since Contact">
            <apex:inputField value="{!contact.Days_Since_Contact__c}" />
          </apex:column>  
            <!-- This is the second half of the trick to keep track
                  of your row index for deletion. -->
            <apex:variable var="rowNum" value="{!rowNum + 1}" />
            <apex:commandLink value="Delete" action="{!removeFromList}" rerender="childList, messages" immediate="true">
              <apex:param name="removeIndex" assignTo="{!removeIndex}" value="{!rowNum}" />
            </apex:commandLink>
        </apex:pageBlockTable>
        <!-- Want to specify immediate here and above so validation does
              not occur when you are trying to add/remove rows. Only want
              validation to occur when trying to save -->
        <apex:commandButton value="Add Contact" action="{!addToList}" rerender="childList, messages" immediate="true" />
      	</apex:pageBlockSection>
      </apex:pageBlock>
    </apex:form>
</apex:page>
Thanks!