I'm trying to create vf email template.I 'm getting the below error
Error: Unknown property 'core.email.template.EmailTemplateComponentController.Opportunity'
for opportunity-Product and OSF Order Iems are related lists.
work around:
<messaging:emailTemplate subject="NA US Credit Check Notification"
recipientType="User"
relatedToType="Opportunity">
<messaging:plainTextEmailBody >
Hi COS team,
I have just Closed/Won the opportunity `{!Opportunity.Name}` related to the account `{!Opportunity.Account}`.
[Product2ID] - [BigMachines Part Number] - [Hyperion Code] - [OSF Order Item - Part Number]
<apex:repeat var="cx" value="{!relatedTo.Product2}">
[{!cx.Id}] - [{!cx.BigMachines__Part_Number__c}] - [{!cx.Hyperion_Code__c} ] ]
</apex:repeat>
<apex:repeat var="xx" value="{!relatedTo.OSF_Order_Items__c}">
[{xx.Part_Number__c}]
</apex:repeat>
Please follow this link to access the Order Summary Form information: {!Opportunity.Link}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>
Best Answer
Your relatedTo object is the Opportunity, so you should be referencing it as {!relatedTo.field}, not {!Opportunity.field}.