function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ahboahbo 

Visual Force Page : Accessing the Fields in Parent or Child Object

Hi ALL

 

I've created a custom object call Quotation and I would like to create a visual force page

in Quotation Tab that will access information in Account, Contacts and other customer object as well

 

I have a field in Quotation call Account_Name which is reference to the name of the account....

 

I don't know why I cannot call the field with the following code, please help !!!

 

<apex:smileytongue:age standardController="Quotation__c">

  {!Quotation__c.Account.Name}

</apex:smileytongue:age>

 

This is the error message I can see...

Error : Invalid field Account for SObject Quotation__c

Best Answer chosen by Admin (Salesforce Developers) 
Ron HessRon Hess

  {!Quotation__c.Account.Name}

 

 

should probably be {!Quotation__c.Account__r.Name}

All Answers

Ron HessRon Hess

  {!Quotation__c.Account.Name}

 

 

should probably be {!Quotation__c.Account__r.Name}

This was selected as the best answer
ahboahbo

Problem still exists !?

Error : Invalid field Account__r for SObject Qutation__c

 

 

Any one can suggest me some tutorials to read !?

Ron HessRon Hess
you must add a lookup field to quote that specifies an account, not just the account name.  as a string, the account name does not provide the relationship to account table.
samonsamon

Is this problem solved? I have the same problem now.

 

I have created a lookup relationship field in the child object. It still does not let me retrieve the values of the parent object.

My standard controller is set to the child object.

elpaso750elpaso750

Hi,

I'm having the same issue. The relation is actually there and I'm using either the __c or the __r notation but keep getting errors like : 

 

 

Save error: Unknown property 'String.Name'

 

or some scary :

 

 

Save error: Unable to perform save on all files: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 670267910-3442 (-1057160073)