I have a custom object,
myObject__c and on the
Product2 object we have a field (
Product2.myObject_lookup__c) that is a lookup to the
myObject__c object. I need to export the relationship between
myObject__c so that I can import the data into a sandbox that was recently refreshed. However, I cannot export the
myObject__c records together.
- How can I export the records for both objects such that they create the same data in a sandbox?
What we tried but no success
sfdx force:data:tree:export -u myTargetUsername --query "select id, (select id from product2) from myObject__c" --prefix data-export mydir/targetFolder --plan
Alternative that didn't export the myObject__c records, only Product2
sfdx force:data:tree:export -u myTargetUserName --query "select id, myObject_lookup__r.Name, myObject_lookup__r.field1__c, myObject_lookup__r.field2__c from Product2" --prefix data-export mydir/targetFolder --plan
Error at Row:1:Column:28 If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.