+ Start a Discussion
Brandon COFFINBrandon COFFIN 

SOQL get information from a child of another object


I am working on quotes and I need to retrive information from a custom child object of Product we created.
On the quote record page, when we click on a button, a PDF is generated.
For each product associated to the quote, information are returned from Quote Line Item by a SOQL query.
I would like to retrieve the information I need on the Product child object (one record of this object is associated to only one product).

Here is the query we use :
qlis = [SELECT Id, PriceBookEntry.Product2.Name, Description, Notes__c, UnitPrice, Quantity, TotalPrice, Total_Weight__c, CurrencyIsoCode, Weight__c, PricebookEntry.Product2.ProductKey__c, PricebookEntry.Product2.Item_designation_marking__c FROM QuoteLineItem WHERE QuoteId = :quoteId];

User-added image
What is the best way to do this ? I would like to do this in only one query but I don't think it is possible.
You can use relation query or nested query for retriving the records of child.
Brandon COFFINBrandon COFFIN
The object I am trying to reach is not the child object of Quote Line Item but Product and my main query is from Quote Line Item