Hello,
We're trying to run a SOQL query to collect grandchild records for Excel row replication, this time having a Polymorphic relationship between the grandchild object "Products Required" and its parent level as follows [Parent] Work Order > Work Order > Product Required.
In a similar relationship - without the polymorphism - for Account > Opportunity > Opportunity Products we used the following solution provided by @natsu_docs worked:
SELECT Tfields] FROM OpportunityLineItem WHERE Opportunity.Account.Id='<<Account_Id>>'
For the relationship iParent] Work Order > Work Order > Product Required we are trying with:
SELECT Cfields] FROM ProductRequired WHERE (What.Type IN ('WorkOrder') AND ParentRecord.ParentWorkOrder.Id ='<<WorkOrder_Id>>')
APIs are as follows:
Product Required object = ProductRequired
Work Order object = WorkOrder
Product Required parent record lookup = ParentRecordId dMaster-Detail(Work Order,Work Order Line Item,Work Type)]
Parent Work Order = ParentWorkOrderId
rStarting Object: WorkOrder]
Any help is much appreciated!