3

I am new to the salesforce and creating an VisualForce Email Template and I have a field which I want to show in VF Email Temlate, but when I am trying to show it

Account object is having the below fields of data type Address (PersonMailingAddress)

enter image description here

I get the following error, please guide:

Error: Unsupported type: common.api.soap.wsdl.Address used in expression: relatedTo.Account.PersonMailingAddress

enter image description here

The Email Template Code that I have written ?

<messaging:emailTemplate subject="My Subject Testing" recipientType="User" relatedToType="Case">   
    <messaging:htmlEmailBody >

        <table border="1px">
            <tr>
                <td>Full Name</td><td>{!relatedTo.Account.Name}</td><td rowspan="3">Address</td><td rowspan="3">{!relatedTo.Account.PersonMailingAddress}</td>
            </tr>
        </table>       
    </messaging:htmlEmailBody>

</messaging:emailTemplate>
4

A more correct merge would be something more like:

{!relatedTo.Account.PersonMailingStreet}<br />
{!relatedTo.Account.PersonMailingCity}, {!relatedTo.Account.PersonMailingState} {!relatedTo.Account.PersonMailingPostalCode}
5

Address is a Compound field which can only be accessible by SOAP or REST API.

You cannot use Address compound field in VFP. You need to use individual fields of the Address.

{!relatedTo.Account.PersonMailingStreet}
{!relatedTo.Account.PersonMailingCity}
{!relatedTo.Account.PersonMailingState}

Refer Address Compound field

1

Mailing Address is a combination of 5 fields (MailingCity, MailingStreet, MailingState, MailingPostalcode & MailingCountry). You cannot add mailing address directly to the Visualforce template. Add Each of the above 5 fields individually to the template.

  • How we can get that value? This does not works for me !relatedTo.Account.PersonMailingAddress.MailingCity – user4567570 May 1 '17 at 15:00
  • It's now seven or nine fields, not five. Longitude and Latitude, plus StateCode and CountryCode if state and country picklists are enabled. – sfdcfox May 1 '17 at 15:05
  • Oh yes you are tight.. – Ricky May 1 '17 at 15:14
  • @user4567570 Two things. You don't need to mention account with relatedto. second mailing city is not sub field of Personalmailingaddress. so try this !relatedTo.MailingCity – Ricky May 1 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.