I am new to Salesforce and I am struggling to get my head around the correct SOQL which correctly reference multiple tables.
Some background:
I have a custom field in Order Product
called Teacher_c
. This field is related to Contact
with child relationship name Order_Products2
.
In the WSDL - For Contact
:
<element name="Order_Products2__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>
In the WSDL - For OrderItem
:
<element name="Teacher__c" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="Teacher__r" nillable="true" minOccurs="0" type="ens:Contact"/>
I have tried to write SOQL to get all order items and include the teacher name such as:
SELECT OrderItem.Id, OrderItem.UnitPrice, OrderItem.Quantity, Teacher_r.name
FROM OrderItem
I know the error is Teacher_r.name
but I have tried a number of different attempts without luck.
Any ideas?