These fields contain a person name in the usual format, but SOQL returns Id of the record as strings. Can the SOQL query results display this as the actual name? Thanks!!!
1 Answer
This field have to be lookup. Lookup and Master-Detail are specific kind of field. From user perspective they are displayed as a name of parent object. But from code prespective those are Ids of parents objects.
If you want access name of parent object by SOQL you have to reference Name field on Parent object.
for custom object it will look like
SELECT ParentObjectLookup__r.Name FROM ChildObject.
'__r' construction allows you access parent object
In case of standard object you have to use same logic but construcyion is diffrent. For example thats how get Account Name from opportunity
SELECT Acccount.Name FROM Opportunity
Please read some more about SOQL to better understand relations in Salesforce .
Name
field of an object when inserting it by default it set theId
value of the record for theName
. Then when you are retrieving the data back, Name field will be havingId
value.