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
iownrocknrolliownrocknroll 

Visual Force Email Template Opportunity, OpportunityLineItems, Product

Hello 

I am trying to create an e-mail template to send contacts an e-mail about product information using a visual force page.

 

I can send them the information such as the Product ID, the Quantity and the last date it was modified, but I can't send them the product 'NAME' as the name is not stored int he OpportunityLineItems Object

 

Is there a way to insert a join between OpportunityLineItems and Product2 based off the PricebookentryID to show insert the Product Name next to the Database ID?

 

Below is my code

 

Thank you

 

 

<messaging:emailTemplate subject="pd2" recipientType="Contact" relatedToType="Opportunity">
<messaging:HtmlEmailBody >
<center>
<table border="0">
 <tr>
     <th>Product</th>
     <th>Quantity</th>
     <th>Last Modified Date</th>
 </tr>
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
    <td>
        <a href="https://na4.salesforce.com/{!cx.id}">{!cx.Description} </a>
    </td>
</tr>
     <td>{!cx.PRICEBOOKENTRYID}</td>
     <td>{!cx.Quantity}</td>
     <td>{!cx.LastModifiedDate}</td>
</tr>
     </apex:repeat>
</table>
</center>
</messaging:HtmlEmailBody>
</messaging:emailTemplate>

<messaging:emailTemplate subject="pd2" recipientType="Contact" relatedToType="Opportunity"><messaging:HtmlEmailBody ><center><table border="0">


 <tr>     <th>Product</th>     <th>Quantity</th>     <th>Last Modified Date</th>
 </tr>


<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}"><tr>    <td>        <a href="https://na4.salesforce.com/{!cx.id}">{!cx.Description} </a>    </td></tr>     <td>{!cx.PRICEBOOKENTRYID}</td>     <td>{!cx.Quantity}</td>     <td>{!cx.LastModifiedDate}</td>
</tr>     </apex:repeat>


</table></center></messaging:HtmlEmailBody></messaging:emailTemplate>

 

<messaging:emailTemplate subject="pd2" recipientType="Contact" relatedToType="Opportunity"><messaging:HtmlEmailBody ><center><table border="0"> <tr>     <th>Product</th>     <th>Quantity</th>     <th>Last Modified Date</th> </tr><apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}"><tr>    <td>        <a href="https://na4.salesforce.com/{!cx.id}">{!cx.Description} </a>    </td></tr>     <td>{!cx.PRICEBOOKENTRYID}</td>     <td>{!cx.Quantity}</td>     <td>{!cx.LastModifiedDate}</td></tr>     </apex:repeat></table></center></messaging:HtmlEmailBody></messaging:emailTemplate>

WesNolte__cWesNolte__c

Hey

 

You could create a formula field on the Opportunity object that does the lookup for you, and they just reference that field directly.

 

Wes