• JoreeBabu Kodi
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
The code below displays eight fields from account in a Visualforce page used as a custom console component in opportunity page layouts. All but two of these fields are enabled for inline editing.

The first row of five fields displays its row of headerValue column headers correctly. The second row of three fields displays the column values, but not the headers (Vertical Tier 1, Vertical Tier 2, etc.). What am I doing wrong?

Also asked as Stackexchange question here (https://salesforce.stackexchange.com/questions/97186/how-can-i-force-display-of-headervalue-header-in-row-2-of-pageblocktable).
 
<!-- render key account fields pulled by query in acctInfo method of custom extension -->
 <!-- saveAccount method of extension handles DML -->
 <apex:form >
   <apex:pageBlock title="Account Info" id="acctInfo" mode="inlineEdit" >
     <apex:pageBlockButtons location="top" >
       <apex:commandButton action="{!saveAccount}" value="Save" />
     </apex:pageBlockButtons>
     <apex:outputPanel id="accountInformationPanel">
       <apex:pageBlockTable id="AcctTable" title="Acct Info" value="{!acctInfo}"
        var="a" columns="5" rows="2" width="100%">
         <apex:column value="{!a.Account_Type__c}"/>
         <apex:column value="{!a.BillingCountry}"/>
         <apex:column headerValue="Industry">
           <apex:outputField value="{!a.Industry}">
             <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                 hideOnEdit="editButton" event="ondblclick"
                 changedStyleClass="myBoldClass"
                 resetFunction="resetInlineEdit"/>
           </apex:outputField>
         </apex:column>
         <apex:column headerValue="Subindustry">
           <apex:outputField value="{!a.Subindustry__c}">
             <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                  hideOnEdit="editButton" event="ondblclick"
                  changedStyleClass="myBoldClass"
                  resetFunction="resetInlineEdit"/>
           </apex:outputField>
         </apex:column>
         <apex:column headerValue="Employees">
           <apex:outputField value="{!a.NumberOfEmployees}">
             <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                 hideOnEdit="editButton" event="ondblclick"
                changedStyleClass="myBoldClass"
                resetFunction="resetInlineEdit"/>
           </apex:outputField>
         </apex:column>
         <apex:column breakBefore="true" headerValue="Vertical Tier 1">
           <apex:outputField value="{!a.Vertical_Tier_1__c}">
             <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                 hideOnEdit="editButton" event="ondblclick"
                 changedStyleClass="myBoldClass"
                 resetFunction="resetInlineEdit"/>
           </apex:outputField>
          </apex:column>
          <apex:column headerValue="Vertical Tier 2"> 
            <apex:outputField value="{!a.Vertical_Tier_2__c}">
              <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                  hideOnEdit="editButton" event="ondblclick"
                  changedStyleClass="myBoldClass"
                  resetFunction="resetInlineEdit"/>
            </apex:outputField>
          </apex:column>
          <apex:column headerValue="Vertical Tier 3">
            <apex:outputField value="{!a.Vertical_Tier_3__c}">
              <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                  hideOnEdit="editButton" event="ondblclick"
                  changedStyleClass="myBoldClass"
                  resetFunction="resetInlineEdit"/>
            </apex:outputField>
          </apex:column>
       </apex:pageBlockTable>
       </apex:outputPanel>

 

I'm very new to this so any  help would be of great assistance!

I'm currently using the below trigger;
I'm trying to get the trigger to update the AccountOwnerID ONLY within "Contacts"  when the "Accounts" ownerID is changed.

Currently "Oppurtunities" is being changed as well, which defeats the purpose for us.

I'm not sure this is even possible, so any help would be greatly appreciated.
 

trigger Changeownertrigger on Account (after insert,after update) {
       
          Set<Id> accountIds = new Set<Id>();
          Map<Id, String> oldOwnerIds = new Map<Id, String>();
          Map<Id, String> newOwnerIds = new Map<Id, String>();
          Contact[] contactUpdates = new Contact[0];
          
          for (Account a : Trigger.new)
          {
             if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId)
             {
                oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId);
                newOwnerIds.put(a.Id, a.OwnerId);
                accountIds.add(a.Id);
             }

          }
            if (!accountIds.isEmpty()) {
             for (Account acc : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) FROM Account WHERE Id in :accountIds])
                {
                String newOwnerId = newOwnerIds.get(act.Id);
                String oldOwnerId = oldOwnerIds.get(act.Id);
                for (Contact c : acc.Contacts)
                {
                   if (c.OwnerId == oldOwnerId)
                   {
                   Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId);
                   contactUpdates.add(updatedContact);
                   }
                }
                 
                }
           }
                update contactUpdates;
    }