Skip to main content
Nintex Community Menu Bar
Solved

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

  • Jun 24, 2022 8:18 PM UTC
  • 3 replies
  • 273 views
  • Translate All

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>>'

View original

3 replies

natsu_docs
Nintex Employee
Forum|alt.badge.img+8
  • Nintex Employee
  • Answer
  • Jun 27, 2022 8:56 AM UTC

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>>'

Translate

  • Author
  • Jun 27, 2022 10:10 AM UTC

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

Translate

  • Author
  • Jun 28, 2022 5:00 PM UTC
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.
Translate