3

I have page which uses contact standard controller which is as below

<apex:page standardController="contact">
    {!contact.account.name}
</apex:page>

When I pass a valid id for contact it displays related account name, without any error.

In the Salesforce quickstart documentation for Displaying Field Values with Visualforce: http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_display_field_values.htm

Note: You cannot access parent objects using this expression language. In other words, {!account.parent.name} will return an error.

As per this, my code was supposed to throw an error. Why that did not happen?

  • You aren't very clear as to what you are asking. Are you saying that you get that error, or are you asking why you aren't getting that error? – dphil May 21 '14 at 14:46
  • edited query ..hope its more clear now – sfdc99999 May 21 '14 at 14:48
  • I don't see anything in that document that says it should throw an error. It makes sense that what you are putting in there could work. – dphil May 21 '14 at 14:53
  • ok..so then what does this mean by?You cannot access parent objects using this expression language. In other words, {!account.parent.name} will return an error. – sfdc99999 May 21 '14 at 14:54
  • 4
    More to the point, Visualforce has supported this syntax for many releases, so I ponder when this verbiage made it into the docs. – sfdcfox May 21 '14 at 15:36
2

I've confirmed that the code works as described. sfdcfox notes that this syntax has worked for many releases. I'd say the answer is that the documentation has not been updated.

  • Someone should report the inaccuracy using the feedback widget at the bottom of the documentation page. (if they haven't already) – Mark Pond May 21 '14 at 17:45

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.