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
sales4cesales4ce 

Tabbed Accounts with Tabs in Focus

Hi,

 

I have used cook book version of tabbed accounts and wanted to extend that to my custom object as well.

I have a roadblock on getting the focus of the tabs.

 

What i want is whenever users select "Contact" tab and select New contact, after creation of new contact i want the user to get back to the contact tab and not default landing tab, which is 'detail' tab.

 

Any ideas on how to accomplish this?

 

VF Page:

<apex:page standardController="Account" showHeader="true" tabStyle="account" >
     <style>
        .activeTab {background-color: #236FBD; color:white; background-image:none}
        .inactiveTab { background-color: lightgrey; color:black; background-image:none}
     </style>
     <apex:tabPanel switchType="client" selectedTab=" tabdetails" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">  
       <apex:tab label="Details" name="AccDetails" id="tabdetails">
           <apex:detail relatedList="false" title="true"/>
       </apex:tab>
        <apex:tab label="Contacts" name="Contacts" id="tabContact">
           <apex:relatedList subject="{!account}" list="contacts" />
      </apex:tab>
        <apex:tab label="Opportunities" name="Opportunities" id="tabOpp">
          <apex:relatedList subject="{!account}" list="opportunities" />
       </apex:tab>
        <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
           <apex:relatedList subject="{!account}" list="OpenActivities" />
       </apex:tab>
        <apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt">
           <apex:relatedList subject="{!account}" list="NotesAndAttachments" />
       </apex:tab>
    </apex:tabPanel>
  </apex:page>

 

 

Thanks,

Sales4ce

Alex_ConfigeroAlex_Configero

 

One solution is to set the saveURL parameter on the new contact button to point to the page and pass a url parameter indicating which tab to activate.

 

&saveURL=%2Fapex%2FNAMEOFYOURPAGE%3Factivetab%3DtabContact

 

On the controller you assign the parameter to a variable

 

activetab=ApexPages.currentPage().getParameters().get('activetab')];

 

And on the vf page you set the value to that

 

<apex:tabPanel switchType="client" value="{!activetab}" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">