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
KSTNEKSTNE 

Need help with apex tabs

Hi,

 

We are adding tabs to our Account, Contact, Lead and Opportunities pages. We have already added custom pages and used the Apex code to create the tabs.

 

However, the problem we are having is when we are trying to add "Activity History", "Open Activities" or any other objects to our custom tabbed page.

 

The error we get looks like this,

 

 
'activityhistory' is not a valid child relationship name for entity Lead 

 

Here is the code that we use to create tabs and add "Activity History",

 

 

 

      <apex:tab label="Lead Detail" name="LeadDetails" id="tabdetails" styleclass="AcctListStyle">
             <apex:detail relatedList="false" title="true"/>
             
             <apex:relatedList subject="{!lead}" list="activityhistory" />             
      </apex:tab>

 

 

If you could please post a step by step process on how to get this resolved, thanks in advance!

 

Best Answer chosen by Admin (Salesforce Developers) 
crop1645crop1645

Did you try this name for the related list: 'ActivityHistories'? 

 

<apex:page standardcontroller="Lead">
        <apex:tabPanel >
             <apex:tab label="Lead Detail" name="LeadDetails" id="tabdetails" styleclass="AcctListStyle">
             <apex:detail relatedList="false" title="true"/>
             
             <apex:relatedList subject="{!lead}" list="activityhistories" />              
              </apex:tab>
        </apex:tabPanel>     
                         
   
</apex:page>

 Best practice is to look up the relationship name using the schema browsers such as in Eclipse IDE as they often are not what you see in the UI

All Answers

crop1645crop1645

Did you try this name for the related list: 'ActivityHistories'? 

 

<apex:page standardcontroller="Lead">
        <apex:tabPanel >
             <apex:tab label="Lead Detail" name="LeadDetails" id="tabdetails" styleclass="AcctListStyle">
             <apex:detail relatedList="false" title="true"/>
             
             <apex:relatedList subject="{!lead}" list="activityhistories" />              
              </apex:tab>
        </apex:tabPanel>     
                         
   
</apex:page>

 Best practice is to look up the relationship name using the schema browsers such as in Eclipse IDE as they often are not what you see in the UI

This was selected as the best answer
Karthik SalesforceKarthik Salesforce

Hi,

 

  Please Use the below code

 

   <apex:relatedList list="OpenActivities"/>
  <apex:relatedList list="ActivityHistories"/>

 

 

Thanks,

Sai

KSTNEKSTNE

Thanks to both of you, both answers did the trick!