+ Start a Discussion
coolKarnicoolKarni 

display lookup field

I have a lookup relationship  for a custom object with account. I am displaying the fields of object within a pageblocktable using the soql query.

In the Pageblocktable the lookup field is displayed with the id of account instaed of Name. How can i display the account name for this in page block table.

 

SoQL:

 

select id, field1__C, filed2__c, lookup__c from object__c

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
coolKarnicoolKarni

Hi,

Here i got the soln:

 

 

select id, field1__C, filed2__c, lookup__r.Name from object__c

 

Here wehave to use relationship query.

 

-Shaan

 

 

All Answers

sunil316sunil316

SoQL:

 

select id, field1__C, filed2__c, lookup__c.Name from object__c

 

 

 

-Sunil 

coolKarnicoolKarni

Hi,

Here i got the soln:

 

 

select id, field1__C, filed2__c, lookup__r.Name from object__c

 

Here wehave to use relationship query.

 

-Shaan

 

 

This was selected as the best answer