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
sai.sfsai.sf 

How to display Contact history Related List in Visual force page?

Hi all,

I want to display Contact History as a related list in Visual force page. I am trying below syntax

<apex:page standardController="Contact">
        <apex:relatedList list="Histories"/>
</apex:page>

But it is giving error as 'Histories' is not a valid child relationship name for entity Contact'

Please let me know the correct syntax of API name for Contact history to display it as a related list.

 

Thanks

ShamilShamil

History related list is a special one, and requires you to build your own table, similar to:

 

<apex:page standardController="Contact">
        <apex:pageBlock id="thePageBlock">            
            <apex:pageBlockTable value="{!contact.Histories}" var="c">
                <apex:column headerValue="Date"  value="{!c.createddate}"/>
                <apex:column headerValue="What" value="{!c.field}"/>
                <apex:column headerValue="From" value="{!c.oldvalue}"/>
                <apex:column headerValue="To"   value="{!c.newvalue}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
</apex:page>

 Here's a discussion for the same problem