+ Start a Discussion
Simon WhightSimon Whight 

Visualforce Email - Text Area causes error

<!--Table 27 **************************************************************************************-->
         
         <table border="0" >
           <col width="150"/>
           <col width="150"/>
           <col width="150"/>           
           <col width="150"/>
           <col width="150"/>   
           <col width="150"/>  
           <caption>Contacts and Users</caption>
           <tr>
            <th>Street</th>
            <th>City</th>
            <th>County</th>
            <th>Postcode</th>
            <th>Telephone No</th>
            <th>Site Type</th>
          </tr>
        <apex:repeat var="sitex" value="{!relatedTo.Site}">  
          <tr>
            <td>{!sitex.Street__c}</td>
            <td>{!sitex.City__c}</td>
            <td>{!sitex.County__c}</td>
            <td>{!sitex.Postcode__c}</td>
            <td>{!sitex.phone}</td>
            <td>{!sitex.Site_Type__c}</td>
          </tr>
        </apex:repeat> 
        </table>

The above is causing this error: [Error] Error: Unknown property 'String.Street__c'.

Assuming I need something there to drag street name out of the error appropriately. Can someone assist with the syntax?

Thanks
Best Answer chosen by Simon Whight
Simon WhightSimon Whight
        <apex:repeat var="sitex" value="{!relatedTo.Sites__r}">  

I'll be on my way now. Use the relationship name in the Master-Detail field!

All Answers

BalajiRanganathanBalajiRanganathan
there is no problem with the syntax. apex:repeat expects a list but your are passing string.

you have problem with this value="{!relatedTo.Site}">. what is the type of Site? you might have to use different field here. also what is the type of relatedTo here
Simon WhightSimon Whight
It's not the text area, it's because it is a custom object. 

It links via Master-Detail to Account.

I've changed it to Site__c in the repeat, but still no joy.
Simon WhightSimon Whight
        <apex:repeat var="sitex" value="{!relatedTo.Sites__r}">  

I'll be on my way now. Use the relationship name in the Master-Detail field!
This was selected as the best answer