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
kalyforminkalyformin 

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?

SuperfellSuperfell
Yes, this is correct.
kalyforminkalyformin

Thanks.

 

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?

SuperfellSuperfell
you access the Name field from that nested object.