List of Case Comment in the related Case using Apex Visualforce

You need to build the list yourself using the raw collection of data like this in your Apex Visualforce page,

Step 1: Create a new Visualforce Page Called RelatedCaseComment
<apex:page standardController="Case">
    <apex:pageBlock >
    You're looking at some related lists for {!case.casenumber}:
    </apex:pageBlock>  
    <apex:pageBlock>
        <apex:pageBlockTable value="{!case.casecomments}" var="c">
            <apex:column value="{!c.commentbody}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>

</apex:page>

Step 2: Create a New Case and Create a case comments in the related case(500L0000000wTxz).
https://cs8.salesforce.com/500L0000000wTxz
Step 3: Run the URL like https://cs8.salesforce.com/apex/RelatedCaseComment?id=500L0000000wTxz
with the parameter of case id, which you created.
Step 4: Now you can get the Case Comments details along with the related Case.

Written by 

Salesforce MVP | Lightning Champion | 16x Salesforce Certified | Application Architect | 6x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*