Skip to main content
Nintex Community Menu Bar
Solved

SOQL query to collect grandchild records for Excel row replication: Account > Opportunity > Opp Prod

  • June 24, 2022
  • 3 replies
  • 202 views

Hello,
We're trying to run a SOQL query to collect grandchild records for Excel row replication.
Our objects are Account > Opportunities > Opportunity Products (Opportunity Line Items)
In this case, we want to collect all Opportunity Products (Opportunity Line Items) from all Opportunities for a given Account, and using Row replication extract the data into an Excel file.
We are trying this SOQL query:

SELECT Product2Id FROM OpportunityLineItem WHERE OpportunityId in (select ID from Opportunity where AccountId ='<<Account_Id>>')

If we replace the <<Account_Id>> with a specific Account (URL) id then the above works in the developer console as desired. However, we would like to use a dynamic Account Id approach where we are running the DDP from an Account record as a starting point.
Other parameters we are using:
[Starting Object: Account]
[Repeat By: Row]

Any help is much appreciated!

Best answer by natsu_docs

Hi,

 

If you're looking to pull in the grandchild object from the Account I recommend the following SOQL:

 

SELECT [fields] FROM OpportunityLineItem WHERE Opportunity.Account.Id='<<Account_Id>>'

3 replies

natsu_docs
Nintex Employee
Forum|alt.badge.img+8
  • Nintex Employee
  • Answer
  • June 27, 2022

Hi,

 

If you're looking to pull in the grandchild object from the Account I recommend the following SOQL:

 

SELECT [fields] FROM OpportunityLineItem WHERE Opportunity.Account.Id='<<Account_Id>>'


  • Author
  • June 27, 2022

Hi @natsu_docs,

Thank you for the reply. We are still getting errors.
Consider that we are trying to replicate rows in Excel, but we have tried both in Word and Excel to research:
In Excel, we are obtaining the following error message: "An error occurred processing a Microsoft Office file. (InternalError) Include this Error Id if you contact Nintex Support: 4901128a-1a86-4100-b0a3-937feb34d532."
In Word, there is no error message but no results are returned.
We attach a screenshot with the relationship and the field tagger below.
Kind regards,
David


  • Author
  • June 28, 2022
The proposed solution work. The second part (Excel file) was resolved by adding a second field into the line item columns as replication needs to be continuous in Excel.