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
dev_jhdev_jh 

Unable to reference owner fields from Opportunity Controller

Hi all,

 

I have a VF page on Opportunity in which I want to display owner information. If I use the standard Opportunity controller I can do this without a problem:

 

{!Opportunity.Owner.LastName}

 

However, I have created a controller extension since I need to order the OppLineItems in a certain way and do a bit more stuff. Now the above line is failing which kind of makes sense because there is no "Owner" field on an opportunity, only an "OwnerId" field. Howeve if I try:

 

{!Opportunity.OwnerId.LastName}

 

I get an "unknown property 'String.LastName'

 

Any ideas? Thanks,

 

J

Best Answer chosen by Admin (Salesforce Developers) 
dev_jhdev_jh
Sorted, I had to reference Owner.LastName in the SELECT within the Controller (I was trying to reference "Owner" by itself).