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
<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
Can you paste your code here.
Looks like you are not using right relationship name .
<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
Use below code.
Let us know if it helps you.