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
padmini sspadmini ss 

SOQL Query from Child to parent 3 level

i can able to Query only 2 level 
these are my Sobjects and filds all are in lookup relationship
Order,OrderItem(Order_product__c), Sales_Order_Line_Item_Schedule__c

ORDER Fields 

Name,OrderNo__c
ORDERITEM (ORDER_PRODUCT__c) Fileds
Material_Code__r.Name,Quantity,ListPrice

Sales_Order_Line_Item_Schedule__c Fields
Name,Schedule_Date__c,Schedule_Quantity__c

This is my Query

SELECT Name,Schedule_Date__c,Schedule_Quantity__c,

 Order_Product__r.Material_Code__r.Name,Order_Product__r.Quantity,Order_Product__r.ListPrice, Order_Product__r.Item_Number__c

FROM Sales_Order_Line_Item_Schedule__c
 

I want to query ORDER Fields , don't know how to accomplish this task , please help me

thanks

 

YuchenYuchen
Does your OrderItem looks up Order Object? If it does, you can try adding "Order_Product__r.Order__c" or "Order_Product__r.Order__r.Name" to your original query. Here, I assume "Order__c" is the API Name you use for the Order Lookup Field. If you are using some other API Name, just replace the API name and put it in the query.