You need to sign in to do that
Don't have an account?
b.gonzalez
VF email template - related list on opportunity object?
Creating a VF email tempate for the opportunity object. On the opportunity object we have a related list called Note to Distributor (API Name: Note_to_Distributor__c). I am trying to have the Note to Distributor to appear in the the VF emial template.
I am recieving the following error: Invalid field Note_to_Distributor__c for SObject Opportunity. This is the section of the code regarding the error. I am not sure why API Name for Note to Distributor is incorrect?
Here is the entire VF Email Template Code:
I appreciate the help!
Beth
I am recieving the following error: Invalid field Note_to_Distributor__c for SObject Opportunity. This is the section of the code regarding the error. I am not sure why API Name for Note to Distributor is incorrect?
<apex:repeat var="noteToDis" value="{!relatedTo.Note_to_Distributor__c}"> <tr> <td><a href="https://cs16.salesforce.com/{!noteToDis.id}">View</a> | <a href="https://cs16.salesforce.com/{!noteToDis.id}/e">Edit</a></td> <td>{!noteToDis.Note_To_Distributor_Body__c}</td> <td>{!noteToDis.CreatedDate)}</td> </tr> </apex:repeat>
Here is the entire VF Email Template Code:
<messaging:emailTemplate recipientType="Contact" relatedToType="Opportunity" subject="New Note to Distributor: {!relatedTo.ChannelRequestAuthorization__c}" replyTo="pmiprogrammanager@qlogic.com"> <messaging:htmlEmailBody > <html> <body> <STYLE type="text/css"> H3 {color: #004488} TH {font-size: 13px; font-face: arial; color: #004488; background: #dfdfdf; border-width: 1; text-align: center } TD {font-size: 11px; font-face: arial } TABLE {border: solid #CCCCCC; border-width: 1} TR {border: solid #CCCCCC; border-width: 1} </STYLE> <font face="arial" size="2"> <h3>Request:{!relatedTo.ChannelRequestAuthorization__c}- New Note</h3> <p>A new note has been added to the opportunity request. Please see details below. For more information regarding this registration,login into your PMI account and or contact your Qlogic Channel Sales Representative.</p> <table border="1" > <tr> <th>Request Details</th> </tr> <tr> <td><b>Channel Authorization Number:</b></td> <td>{!relatedTo.ChannelRequestAuthorization__c}</td> </tr> <tr> <td><b>Distributor:</b></td> <td>{!relatedTo.Distributor__r.Name}</td> </tr> <tr> <td><b>Reseller:</b></td> <td>{!relatedTo.Reseller__r.Name}</td> </tr> <tr> <td><b>End User:</b></td> <td>{!relatedTo.Account.Name}</td> </tr> <tr> <th>Product List</th><th>Quantity </th> </tr> <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}"> <tr> <td><a href="https://cs16.salesforce.com/{!opp.id}">View</a> | <a href="https://cs16.salesforce.com/{!opp.id}/e">Edit</a></td> <td>{!opp.PriceBookEntry.name}</td> <td>{!ROUND(opp.Quantity,0)}</td> </tr> </apex:repeat> <apex:repeat var="noteToDis" value="{!relatedTo.Note_to_Distributor__c}"> <tr> <td><a href="https://cs16.salesforce.com/{!noteToDis.id}">View</a> | <a href="https://cs16.salesforce.com/{!noteToDis.id}/e">Edit</a></td> <td>{!noteToDis.Note_To_Distributor_Body__c}</td> <td>{!noteToDis.CreatedDate)}</td> </tr> </apex:repeat> </table> <p/> </font> </body> </html> </messaging:htmlEmailBody> </messaging:emailTemplate>
I appreciate the help!
Beth
As per this screenshot, you need to use Notes_to_Distributor__r. So the code will look like:
Thanks,
Neetu
All Answers
As opportunity object have related list called Note to Distributor (API Name: Note_to_Distributor__c). You need to use the child relationship name here. I guess it would be Note_to_Distributors__r. So your code would be like this: Please try this, and let me know if it resolve your problem.
Thanks,
Neetu
Thank you. But I am still recieving the same error.
Beth
This should work, are you sure that your child relationship name for Note_to_Distributor__c is Note_to_Distributors__r.
Please double check the relationship name and if still you are not able to resolve it, I need to look into your salesforce org.
Thanks,
Neetu
As per this screenshot, you need to use Notes_to_Distributor__r. So the code will look like:
Thanks,
Neetu
Thank you for the help!
Beth