+ Start a Discussion
Nathan WylderNathan Wylder 

visualforce email template - Invalid Field for SObject Opportunity

Here is my code. I can not even save this because the related object is not being located. 
I'm trying to generate a list of related payments for an Opportunity. (not sure if it matters, but our org renamed Opportunities to Income)...what's going on? I keep getting this message: "Error: Invalid field OppPayments for SObject Opportunity"
subject="Payment report for Opportunity: {!relatedTo.name}"

            <p>Dear {!recipient.name},</p>
            <p>Below is a list of payments related to {!relatedTo.name}.</p>
            <table border="0" >
                    <th>Case Number</th><th>Origin</th>
                    <th>Creator Email</th>
                <apex:repeat var="cx" value="{!relatedTo.OppPayments}">
                    <td><a href = 
                <apex:outputLink value="http://www.salesforce.com">
                    For more detailed information login to Salesforce.com

Marcelo CostaMarcelo Costa
Hey Nathan...
I guess the {!relatedTo.OppPayments} is giving you the error as the OppPayments is not a standard salesforce field, I think It would be expecting either a __c in the end of the Field Name or a __r in case it is a relationship.
Make sure the field name is right for thye sObject Type...
Good Luck!
Gina Szafraniec 13Gina Szafraniec 13
This is what you should use <apex:repeat var="cx" value="{!relatedTo.npe01__OppPayment__r}">

You need to add the namespace prefix for the managed package on the object.