2

Here is the scructure I have:

Condition__c:

  • ... fields

Account:

  • Lookup to Condition
  • ... fields

Invoice__c:

  • Master detail to Account
  • ... fields

Invoice_Line__c:

  • Master detail to Invoice
  • ... fields

Query is like:

SELECT 
  Id, {fields} , Account__c, Account__r.{fields},
  Account__r.Condition__c, Account__r.Condition__r.{fields},
  ( SELECT Id, {fields} FROM Invoice_Lines__r )
FROM Invoice__c

Command:

sfdx force:data:tree:export -q ./soql/query_file.soql --prefix export-demo -d ./data --plan

Result:

ERROR: Reference Account not found for Account__c. Skipping record a045E000002TEuDQAW. Wrote 1 records to data\export-demo-Invoice__cs.json Wrote 1 records to data\export-demo-Invoice_Line__cs.json Wrote 0 records to data\export-demo-Invoice__c-Invoice_Line__c-plan.json

So I tried to first export the account as this:

SELECT 
  Id, Name, Intracommunity__c,Condition__c, Condition__r.{fields}
FROM Account

And the result is:

ERROR: Reference Condition__c not found for Condition__c. Skipping record 0015E00000aL0FmQAK. Wrote 1 records to data\export-demo-Accounts.json Wrote 0 records to data\export-demo-Account-plan.json

Is there a way relationship between exported records ?

1 Answer 1

2

You must find the Child Relationship Name. So e.g. for Invoice, go to the Invoice object, find the relationship field to Account and get the Child Relationship Name, e.g. Invoices. That's the name you'd use in the query.

Then you'd use "SELECT something...., (SELECT something FROM Invoices) FROM Account", and have the --plan parameter as you already suggest. So none of the __r names.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .