+ Start a Discussion

SOQL Query

I have a custom object called Literature__c that has a custom field called Literature Item. This field is set up as a look up field to a different custom object called Product_Master__c. I'm using a SOQL query to return Name from the Literature__c and Name from the look up object. Below is my sample SOQL


select name, literature_item__r.name from literature__c.


This returns the Name correctly from Literature__c but returns an object Product_Master__c  in the result set. I'm using the Schema Explorer to construct the query.


I'm new to SOQL and not sure if the above query is correct.


Does anyone have any ideas?

Yes, this is correct.



I have just one question. How do we get the Product_Master__c.Name to return a string (Example: Literature packet 1) instead of an object?

you access the Name field from that nested object.