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
vibrationvibration 

VisualForce Email Template: How to Display Related List Information

 

ErrorError: Invalid field Eval_Request_Detail__r for SObject Trial_Request__c
what is the error in following code?
<messaging:emailTemplate subject="Eval Request and Request Details" recipientType="User" relatedToType="Trial_Request__c">
<messaging:htmlEmailBody >
<table>
     <tr>
     <td>  Dear Sir </td>
      </tr>
       <tr>  
           <td> <dd> Below Eval Request and Eval Requestdetails</dd></td>
          </tr>          
                        <tr>
                        <td> Name   : {!relatedTo.Name}</td>
                        </tr>   
                       <tr>
                        <td>Customer Name   : {!relatedTo.Contact_Name__c}</td>
                        </tr>
                        <tr>
                        <td>status   : {!relatedTo.Status__c}</td>
                        </tr>
                        <tr>
                        <td>E-mail Address: {!relatedTo.E_mail_Address__c}</td>
                        </tr>
                        
                         </table>
               
                   <table border="1">
                       <tr>
                           <th> Detail Number </th>
                           <th> Product Name </th>
                           <th> Quantity </th>
                           <th> Remarks </th>
                           
                       </tr>
                      <apex:repeat var="itemslist" value="{!relatedTo.Eval_Request_Detail__r}">
                       <tr>
                       
                       
                          <td>{!itemslist.Name}</td>
                          <td>{!itemslist.Product__c}</td>
                          <td>{!itemslist.Quantity__c}</td>
                          <td>{!itemslist.Remarks__c}</td>
                         
                         
                       </tr>
                        </apex:repeat>
                    </table>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Ritesh AswaneyRitesh Aswaney

Related List Fields are normally in the plural - check the relationship name.

<apex:repeat var="itemslist" value="{!relatedTo.Eval_Request_Detail__r}">

 

should probably read

 

<apex:repeat var="itemslist" value="{!relatedTo.Eval_Request_DETAILS__r}">  (i.e. Plural s)

vibrationvibration

sorry not working. same error occur

prats23prats23

Hey,

 

Check the exact child relationship name. Sometimes it varies and is not the name of the related object, maybe some other name has been given!!

 

Check in the field details of lookup/child field in the master object.

 

Hope this helps!