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
kumar palepukumar palepu 

Error: Invalid field OpportunityLineItem for SObject Opportunity for <apex:repeat value="{!relatedTo.OpportunityLineItem}" var="c"> would you please help me on how to retrive all product name corresponding to oppurtunity

Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi kumar palepu

Can you paste your code here.
Looks like you are not using right relationship name .


 
kumar palepukumar palepu
<messaging:emailTemplate subject="Opportunity won for account {!relatedTo.Account} by {!relatedTo.Name}" recipientType="User" relatedToType="Opportunity" >
<messaging:htmlEmailBody >

<head>

<style>
table, th, td {
    border: 1px solid  skyblue;
}
</style>
</head>
<body>
<b> Products </b>
<table width="75%" rules="all">
<tr>
 <th> productname</th> <th>Quantity </th>
</tr>
<apex:repeat value="{!relatedTo.OpportunityLineItems}" var="c">
<td> {!c.Name} </td>
<td> {!c.Quantity} </td>
</apex:repeat>
</table>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
would you please help me on how to retrive all product names which is corresponding to Opportunity
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi 

Use below code.
<apex:repeat value="{!relatedTo.OpportunityLineItems}" var="c">
       <td> {!c.PricebookEntry.Product2Id.Name} </td>
       <td> {!c.Quantity} </td>
</apex:repeat>

Let us know if it helps you.