[SalesForce] CaseComment and CaseHistory relatedlist in visualforce page

I want to add CaseComment and CaseHistory related list to my visualforce page.

<apex:relatedList list=" " />

What should be the value for List attribute in the code defined above. When I added

<apex:relatedList list="CaseHistory" /> 'Histories' is also not working

<apex:relatedList list="CaseComment" /> 'CaseComments' is also not working

I get errors saying they are not valid child relationship name for entity Case.

Please help me out on this issue.

Best Answer

I tried with this and works for me.

  <apex:pageBlock>
        <apex:pageBlockTable value="{!case.casecomments}"var="c">
            <apex:column value="{!c.commentbody}"/>
        </apex:pageBlockTable>
        <apex:pageBlockTable value="{!case.Histories}" var="c">
            <apex:column value="{!c.OldValue}"/>
            <apex:column value="{!c.NewValue}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
Related Topic