+ Start a Discussion
sudhansudhan 

Invalid field address for SObject Lead in visual force email template

i wanted to use merge fields in visual force email template.It worked fine for relatedTo.name but it doesn't work for relatedTo.address

 

 

<apex:image url="https://na1.salesforce.com/resource/1259064527000/Header"/>
   <b>{!relatedTo.Name}<br>
      {!relatedTo.address}<br>             <-here it doesn't work but previous line works perfectly

ARE YOU IN PAIN?<br>
WE CAN HELP!<br>

 

it display error as invalid field address for sobject lead.

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard
While address appears as a field when viewing through the CRM web site, it isn't on the Lead sObject when using the IDE schema viewer and thus is not a real field on the Lead sObject.  There are some address-like fields on the Lead sObject, e.g. Street, City, State, Country, PostalCode.  It looks like there is some additional functionality in CRM that somehow groups these.

All Answers

bob_buzzardbob_buzzard
While address appears as a field when viewing through the CRM web site, it isn't on the Lead sObject when using the IDE schema viewer and thus is not a real field on the Lead sObject.  There are some address-like fields on the Lead sObject, e.g. Street, City, State, Country, PostalCode.  It looks like there is some additional functionality in CRM that somehow groups these.
This was selected as the best answer
sudhansudhan

Thanks for the solution.In accounts i have two types of addresses namely shipping and billing address if i use

{!relatedTo.ShippingAddress__c.City__c} or{!relatedTo.ShippingAddress__c.City} both are not working.Suggest me to come out of this problem.

Mr Manoj GahlotMr Manoj Gahlot
To access address related information, directly use {!relatedTo.ShippingCity} dierctly because Shipping Address is managed as fieldsets in salesforce.