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

Get the "Contact History" related list in a VF page?

I've enabled Contact History on Contacts.


Adding the related list to a page layout works fine, and I can see the field tracking.


But when I try to call Contact History in my VF page, I keep getting the error


'ContactHistory' is not a valid child relationship name for entity Contact'


I've downloaded my WSDL, and sure enough, it looks like ContactHistory is its own object.  No matter what I try, I can't get this to work.  


Running the code by itself works -- it's only when you run the page against an actual Contact that it blows up.


Here's the code.  Any help would be appreciated.

<apex:page standardController="Contact" showHeader="true" tabStyle="contact" > <style> .activeTab {background-color: #56458c; color:white; background-image:none; font-family: Verdana; font-size: 11px;} .inactiveTab { background-color: lightgrey; color:black; background-image:none font-family: Verdana; font-size: 11px;} .fontSize {font-size: 12px;) </style> <apex:detail relatedList="true" title="true"/> <apex:tabPanel switchType="client" selectedTab="tabdetails" id="ContactTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" contentClass="fontSize"> <apex:tab label="Activity History" name="ActivityHistory" id="tabActHist"> <apex:relatedList subject="{!contact}" list="ActivityHistories" /> </apex:tab> <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct"> <apex:relatedList subject="{!contact}" list="OpenActivities" /> </apex:tab> <apex:tab label="Opportunities" name="Opportunities" id="tabOpp"> <apex:relatedList subject="{!contact}" list="Opportunities" /> </apex:tab> <apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt"> <apex:relatedList subject="{!contact}" list="NotesAndAttachments" /> </apex:tab> <apex:tab label="Contact History" name="ContactHistory" id="tabContactHist"> <apex:relatedList subject="{!contact.histories}" list="ContactHistory" /> </apex:tab> </apex:tabPanel> </apex:page>



Sunil NandipatiSunil Nandipati
I guess you should try once by changing the end point url to 16.0

It might be worth creating a custom controller.  This should allow you to then link the contact history to the contact being viewed via SOQL.


I haven't tried this myself but it was just a thought.