+ Start a Discussion
Bryn JonesBryn Jones 

Referencing Account Field

I have my standard controller as Contact.

The below comes up with 'Error: Invalid field ShippingAddress for SObject Account'

<apex:outputtext Value="Address: {!Contact.account.ShippingAddress}"/> 

But when i use a custom field such as NOC__c instead of ShippingAddress it works fine!!

Please help
Best Answer chosen by Bryn Jones
Phillip SouthernPhillip Southern
No problem, its same approach just setting to the different fields like:

{!Contact.account.Shippingstreet} {!contact.account.shippingcity} {!contact.account.shippingstate} {!contact.account.shippingpostalcode}

Etc..
You just need a merge field for each field you want to access and you can build it out that way.

All Answers

Phillip SouthernPhillip Southern
Hi, compounded address is not available in apex, so you'll need to call each address field.  Spring 14 does make it available but only through API's.
Bryn JonesBryn Jones
How do i reference each feild???

Thanks a ton.
Bryn
Phillip SouthernPhillip Southern
No problem, its same approach just setting to the different fields like:

{!Contact.account.Shippingstreet} {!contact.account.shippingcity} {!contact.account.shippingstate} {!contact.account.shippingpostalcode}

Etc..
You just need a merge field for each field you want to access and you can build it out that way.
This was selected as the best answer
Bryn JonesBryn Jones
Awesome....sorry to be so dumb...never thought about that...VMA (Very much appreciatted)

Couldn't find anything else about it anywhere....

Bryn.