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
shachnashachna 

How do I get the History for a Custom Object on to a Cutom VF page?

I created a tabbed VF page for a custom object to replace the standard layout that we had. I used this piece of code to call all the related lists I needed.

 

 <apex:tab label="History" name="History" id="tabHistory">
        <apex:relatedList subject="{!Clients__c}" list="OpenActivities"/>
   </apex:tab>

 


The trouble I'm having is I don't know (nor ca I guess) the correct name for the standard History Object that appears in every page. Can anyone tell me what I should be putting in the list
part of the code?

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
colemabcolemab

This information can be located in your enterpise WSDL file.

 

The history object will be different for each object.  As an example, this is the section for leads from an enterpise WSDL file:

            <complexType name="LeadHistory">
                <complexContent>
                    <extension base="ens:sObject">
                        <sequence>
                        <element name="CreatedBy" nillable="true" minOccurs="0" type="ens:Name"/>
                        <element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
                        <element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
                        <element name="Field" nillable="true" minOccurs="0" type="xsd:string"/>
                        <element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean"/>
                        <element name="Lead" nillable="true" minOccurs="0" type="ens:Lead"/>
                        <element name="LeadId" nillable="true" minOccurs="0" type="tns:ID"/>
                        <element name="NewValue" nillable="true" minOccurs="0" type="xsd:anyType"/>
                        <element name="OldValue" nillable="true" minOccurs="0" type="xsd:anyType"/>
                        </sequence>
                    </extension>
                </complexContent>
            </complexType>

 

All Answers

colemabcolemab

This information can be located in your enterpise WSDL file.

 

The history object will be different for each object.  As an example, this is the section for leads from an enterpise WSDL file:

            <complexType name="LeadHistory">
                <complexContent>
                    <extension base="ens:sObject">
                        <sequence>
                        <element name="CreatedBy" nillable="true" minOccurs="0" type="ens:Name"/>
                        <element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
                        <element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
                        <element name="Field" nillable="true" minOccurs="0" type="xsd:string"/>
                        <element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean"/>
                        <element name="Lead" nillable="true" minOccurs="0" type="ens:Lead"/>
                        <element name="LeadId" nillable="true" minOccurs="0" type="tns:ID"/>
                        <element name="NewValue" nillable="true" minOccurs="0" type="xsd:anyType"/>
                        <element name="OldValue" nillable="true" minOccurs="0" type="xsd:anyType"/>
                        </sequence>
                    </extension>
                </complexContent>
            </complexType>

 

This was selected as the best answer
shachnashachna

What is my enterpise WSDL file and where do I find it?

colemabcolemab

WSDL = Web Service Definition Language

 

This is an XML file that describes your system.  The enterprise one is strongly typed while the partner one is more generic.

 

Here is a link on generating the WSDL.

 

colemabcolemab

You may find this thread useful as well.

shachnashachna

Thanks

colemabcolemab

Here is another person's blog post that might help too.