You need to sign in to do that
Don't have an account?
Visualforce Email: List - Opportunity Line Items
Hello,
I am beginning to learn visualforce and am stumped at a point in creating a visualforce email template.
My hope was to come up with an email template that could be used in the opportunity object so that when I enter a new opportunity with products listed in the opportunity line items related list the contact would receive an email that would act as an order confirmation. I am stuck while trying to figure out how to list the products in the opportunity line items list.
Below is what I was attempting to use. I was trying to mirror the use of the repeat component that was used in some example code that I found on developerforce. My problem is that it continues to say that Product is not a standard object of OpportunityLineItems. I see that Product is a lookup field and the field name shows as "Product2". Any thoughts?
Thanks, Nick
<messaging:emailTemplate subject="Equipment Order Confirmation" recipientType="Contact" relatedToType="Opportunity">
<messaging:plainTextEmailBody >
Dear {!recipient.name},
The following is confirmation of your equipment order:
Return Date: {! RelatedTo.Return_Date__c}
Equipment Requested
[ Case Number ] - [ Subject ] - [ Email ] - [ Status ]
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
{!cx.Product2} {!cx.Quantity}
</apex:repeat>
</messaging:plainTextEmailBody>
</messaging:emailTemplate>
Are you trying to show the Product name in the repeat section? Your best bet is to create a Formula Field and use that to bring the Product name forward from the Product2 object, then reference that new Formula Field in your template.
-Andy
Use {!cx.PriceBookEntry.name} instead of {!cx.product2}