function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
armsjmacarmsjmac 

Visualforce email template asset error

Hi Guys - i have been search and trying things for the past 10 hours without getting any closer to success.

 

I am trying to setup a VF email template to send an email to contacts pulling in information from assets. I have based it on the example https://developer.salesforce.com/page/VisualForceEmailTemplates_sample

I keep getting an error message of Error: Invalid field Asset for SObject Asset 

I have tried replacing Asset in this line with Assets Assets__c, Asset__c, Asset__r & Assets__rwhich i assume relates to the code in line24
when i leave the original example code of cases in it seems to work just fine. Hoping someone can see a super obvious error

cheers
John

<messaging:emailTemplate subject="Your Annual Maintenance on Isograph Products" recipientType="Contact" relatedToType="Asset">
<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>Dear {!recipient.name},</p>
         <p>Below is a list of cases related to the account: {!relatedTo.name}.</p>
          <table border="0" >
            <tr >
               <th>Product Name</th>
               <th>Copies</th>
               <th>Maintenance Expiry</th>
               <th>Renewal Cost</th>
               <th>Discount</th>
               <th>Discounted Pricing</th>
            </tr>
<apex:repeat var="cx" value="{!relatedTo.Asset}">
              <tr>
               <td>{!cx.Asset.Product_Name__c}</td>
                <td>{!cx.Asset.Quantity}</td>