You need to sign in to do that
Don't have an account?
![Chris Traver Chris Traver](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Help on Email Template with Visual Force to display a related list in an email on a custom object
I can follow the directions on cases and this works but when I apply the code below to my custom object I get errors or can only get one line to appear. The below code products the error Error: Unknown property 'String.QTY__c'. If I take Cx out of the below it only shows one record.
<messaging:emailTemplate recipientType="Contact"
relatedToType="Ordered__c"
subject="Your Order Has Shipped PO # {!RelatedTo.Name}"
replyTo="info@info.com">
<messaging:htmlEmailBody >
<html>
<body>
<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}
</STYLE>
<font face="arial" size="2">
<p> Your order or a portion of your order has shipped. </p>
<p> Purchase Order #: {!relatedTo.Name}</p>
<table>
<tr>
<th>Action</th>
<th>QTY</th>
<th>Part</th>
<th>Description</th>
<th>Tracking</th>
<th>Freight Co</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Name}">
<tr>
<td><a href="https://na1.salesforce.com/{!relatedto.id}">View</a> |
<a href="https://na1.salesforce.com/{!relatedto.id}/e">Edit</a></td>
<td>{!cx.QTY__c}</td>
<td>{!cx.Part__c}</td>
<td>{!cx.Description2__c}</td>
<td>{!cx.Tracking_Number__c}</td>
<td>{!cx.Freight_CO__c}</td>
</tr>
</apex:repeat>
</table>
<p> For more information, login to http://www.salesforce.com</p>
<messaging:emailTemplate recipientType="Contact"
relatedToType="Ordered__c"
subject="Your Order Has Shipped PO # {!RelatedTo.Name}"
replyTo="info@info.com">
<messaging:htmlEmailBody >
<html>
<body>
<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}
</STYLE>
<font face="arial" size="2">
<p> Your order or a portion of your order has shipped. </p>
<p> Purchase Order #: {!relatedTo.Name}</p>
<table>
<tr>
<th>Action</th>
<th>QTY</th>
<th>Part</th>
<th>Description</th>
<th>Tracking</th>
<th>Freight Co</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Name}">
<tr>
<td><a href="https://na1.salesforce.com/{!relatedto.id}">View</a> |
<a href="https://na1.salesforce.com/{!relatedto.id}/e">Edit</a></td>
<td>{!cx.QTY__c}</td>
<td>{!cx.Part__c}</td>
<td>{!cx.Description2__c}</td>
<td>{!cx.Tracking_Number__c}</td>
<td>{!cx.Freight_CO__c}</td>
</tr>
</apex:repeat>
</table>
<p> For more information, login to http://www.salesforce.com</p>
Sorry for this issue you are encountering.
May I suggest you please check with below link from the success community with a similar discussion and a suggested workaround which might help you further with the above requirement.
- https://success.salesforce.com/answers?id=90630000000CfPdAAK
Please let us know if this helps.Kindly mark this as solved if the information was helpful.
Thanks,
Nagendra