4

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>
3

Your relatedTo object is the Opportunity, so you should be referencing it as {!relatedTo.field}, not {!Opportunity.field}.

| improve this answer | |
0

From a quick glance I would have thought you'd need to access the OpportunityLineItems and OSF_Order_Items__r in your repeat blocks.

e.g.

<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.OpportunityLineItems}">
        [{!cx.Id}] - [{!cx.BigMachines__Part_Number__c}] - [{!cx.Hyperion_Code__c} ] ]
    </apex:repeat>

    <apex:repeat var="xx"  value="{!relatedTo.OSF_Order_Items__r}">
        [{xx.Part_Number__c}]
    </apex:repeat>

    Please follow this link to access the Order Summary Form information: {!Opportunity.Link} 


    </messaging:plainTextEmailBody>

</messaging:emailTemplate>
| improve this answer | |
  • Thanks for the reply.yup i changed . And what i observe is here we can't access cross object.This could be done with custom vf – Sindoora Mar 12 '14 at 12:43
0

I think you'll need to use a custom component in your email so you can use the controller behind the component to query the related data and format it for the email how you need it. Salesforce have a good example of how to build one at use it below:

Custom Controllers in Email Templates

Hope this helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.