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
Pavani Akella 9Pavani Akella 9 

how to call child object fields in parent object in VF

I have written a VF page but I'm not able to call the child objects fields in Case object. Can someone help me with the code:

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Case"
    subject="Test: "
    replyTo="support@acme.com" >
    
<messaging:htmlEmailBody >
<html>
    <body>
    <STYLE type="text/css">
        TH {font-size: 12px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
        TD  {font-size: 14px; font-face: arial} 
        TABLE {border: solid #CCCCCC; border-width: 1}
        TR {border: solid #CCCCCC; border-width: 1}
     </STYLE>
     <font face="arial" size="3">
Dear {!recipient.name},
 
<p>Please order replacements parts for the following case</p>

CaseNumber :{!relatedTo.CaseNumber} <br/>
Subject : {!relatedTo.Subject} <br/>
Claim_Type_new : {!relatedTo.Claim_Type_new__c} <br/><br/><br/>

<table border="1">
  
<font face="arial" size="4">
  <tr > 
        <th>Part Name</th><th>Description</th>
    </tr>  
    <apex:repeat var="cx" value="{!relatedTo.Replacement_Parts__r}">
        <tr>
           <td>{!cx.Replacement_Item__c}</td>
            <td>{!cx.Description__c}</td>
        </tr>
    </apex:repeat>   
    </font>           
</table>
<p />
<p>Your UPS tracking number is: {!relatedTo.Replacement_Parts__r.Tracking_ID__c}<br/></p>
<p>PS Order#: {!relatedTo.Replacement_Parts__r.MSR_PS_ID__c}<br/></p>    
<p>Repair Order Number: {!relatedTo.Repair_Order_Number__c}<br/></p>   
            </font>
               
        </body>
    </html>
</messaging:htmlEmailBody> 

</messaging:emailTemplate>

Thanks in advance
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Pavani,

May I suggest you Please refer the below link for reference on call child object fields in parent object in VF. Hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar