Skip to main content

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!

For reference, please note that the following notation works using a static starting record (replacing Xs with actual id):
SELECT Product2Id FROM ProductRequired WHERE ParentRecordId in (select ID from workorder where ParentWorkOrderId='XXXXXXXXXXXxxxXXXX')

Nintex Support provided the solution. Thank you @KevinZ1 :




SELECT [Fields] FROM ProductRequired WHERE ParentRecordId in (select ID from WorkOrder WHERE ParentWorkOrder.Id ='<<WorkOrder_ParentWorkOrder_Id>>')


Finally, not working as expected. Results are being returned from records that are not related.

Reply