• Sonali Kamra 16
  • 15 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

Hi All -


I am new, so please forgive my green - but I am having a perplexing problem in generating a Visual Force email template showing related lists for a custom object.


I CAN get a list of Cases related to an Account with no problem, but when I put in a custom object  (Child Relationship Name "Suppliers") which is also (Master-Detail) related to Account I get the following error: Error: Invalid field Suppliers for SObject Account


I have tried everything I can think of - using API name instead, appending "__c" to the end, but it seems that i can't make any lists at all with custom objects in this code.


Is there a restriction within this type of code that allows only lists with standard objects or is there something I'm missing?


Any help would be greatly appreciated. I am not good enough to make a custom Apex controller yet and a little under the gun to kluge something together.


Thanks much,




Below is relevant code:



<messaging:emailTemplate recipientType="Contact"
    subject="Supplier report for Account: {!relatedTo.name}"
    replyTo="support@acme.com" >
<messaging:htmlEmailBody >   
     <STYLE type="text/css">
           TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
           TD  {font-size: 11px; font-face: verdana }
           TABLE {border: solid #CCCCCC; border-width: 1}
           TR {border: solid #CCCCCC; border-width: 1}
         <font face="arial" size="2">
      <p>Dear {!recipient.name},</p>
      <p>Below is a list of supplier records related to the account: {!relatedTo.name}.</p>
<table border="0" >
        <tr >
            <th>Action</th><th>Product</th><th>Status</th><th>Creator Email</th><th>BL date</th>
<apex:repeat var="cx" value="{!relatedTo.Suppliers}">
       <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |  
       <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>