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
Amit ChaudharyAmit Chaudhary 

Query retrieve related record on query editor but in Apex class it return Id Why ?

select name, from Converted_Customer__c

this query print     value .

  but same query giving Id when i am writing in apex class . why   and how i can access related value in apex class .
This is a very common scenario, and usually works like a charm:

for(Converted_Customer__c cc : [select name, from Converted_Customer__c]){


However, do take care of the following:
  • Eclipse Schema tool shows ID only, if you are trying this query in Eclipse Schema Loader
  • Sometimes, when you create records without populating name, salesforce inserts the record ID in the name field. There is a chance that the Name field of object linking to Paper_Plan__c field has ID instead of actual name. So check the actual record as well.