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
ElJefeElJefe 

standardController is custom object; how to access standard object fields?

I have created a series of custom objects (projects, project task, expense, timesheet, timesheet line items) and am creating a visualforce page for a billing detail report, and the standardController = SFL5_Projects__c.

 

A lookup relationship exists on the Projects (SFL5_Projects__c) object to Account via field Client__c, but I cannot reference Account object via standard syntax to pull back the name of the Account (SFL5_Projects__c.Client__c.name errs out, as standard syntax is .Account.name if I were referencing from a standard object like Opportunity.Account.name).

 

So, my question is how does one reference both standard and custom objects to pull fields (where lookup relationships exist) when the standardController =  a custom object?

Regards,

Jeff

Best Answer chosen by Admin (Salesforce Developers) 
AvromAvrom

Custom relationships use __r syntax, rather than __c.

All Answers

AvromAvrom

Custom relationships use __r syntax, rather than __c.

This was selected as the best answer
ElJefeElJefe

Snippet: 

 Project: {!SFL5_Projects__c.name}, 

{!SFL5_Projects__c.Client__c}

 

Client__c is a lookup to Account but I don't want the Id back, but the name.

 

Avrom, to be clear could you post example?

ElJefeElJefe

ah...client__r.name, yes?

AvromAvrom

Right.