+ Start a Discussion
b.gonzalezb.gonzalez 

VF Email Template: Unknown property 'String.contactId'

Hi there,

I am recieving the following error: String.contactId. I am not sure how to resolve this. I appreciate any assistance. 

Thanks!
<messaging:emailTemplate subject="Marketing Generated Named Account Prospects - NA-Eastern Region" recipientType="User" relatedToType="Campaign">
<messaging:htmlEmailBody > 
     <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 14px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 14px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="3"></font>
        <p>Dear Jim Michelson,</p>
        <p>New marketing generated named account prospect(s) have been assigned to you and are now available for follow up. In addition, attached for your use is a follow up template.</p> 
        <p>To view the prospects that have been assigned to you click on the report link below.</p>
        <apex:outputLink value="https://qlogic--sandbox.cs7.my.salesforce.com/00OM0000000h74W">Named Account Prospects Eastern Region </apex:outputLink><br></br>

<table border="1"></table>
<tr></tr>
<table border="0" >
                 <tr >
                     <th>Prospect First Name</th><th>Prospect Last Name</th><th> Title </th><th> Phone </th><th> Email </th><th> State </th><th> Country </th><th>Company Name</th><th> Marketing Source</th>
                 </tr>
    <apex:repeat var="cm" value="{!relatedTo.CampaignMembers}," Rendered="{!IF(NOT(ISBLANK(!relatedTo.CampaignMembers[0].Notification_Needed__c)),true, false)}">
     <tr>
           <td>{!IF(cm.contactId != null,cm.contact.FirstName,cm.lead.firstname)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.LastName,cm.lead.lastname)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.Title,cm.lead.Title)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.Phone,cm.lead.Phone)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.Email,cm.lead.Email)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.MailingState,cm.lead.State)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.MailingCountry,cm.lead.Country)}</td>
           <td>{!IF(cm.contactId != null,cm.contact.Account.Name,cm.lead.Company)}</td>
           <td>{!cm.Campaign.Name}</td>
           </tr> 
    </apex:repeat>                     
       </table>
       <p>Sincerely,</p> 
       <p>System Administrator</p>
        </body>
    </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Beth