Data Tree Export Not Returning Results
See original GitHub issueSummary
A valid query that should return results will not return results when “sfdx force:data:tree:export” is called with a --query flag
Steps To Reproduce:
- Create a .soql file with a query that is filtering on the Id field. My example below:
SELECT Name FROM Product2 WHERE Id IN ( '01t1X000005P61TQAS', '01t1X0000062jnyQAA', '01t0J00000F4ItSQAV', '01t1X000005P6vXQAS', '01t5I000000AS28QAG', '01t1X000005P7HdQAK', '01t1X0000062uXeQAI' )
- Use the sfdx force:data:tree:export command with the query flag. My example below:
sfdx force:data:tree:export --query scripts/soql/try2.soql --prefix omnichannelBundle --outputdir data/omnichannelBundle --plan -u WP_nDev --json
Expected result
Query should have returned results (That exact query copy pasted into other tools will return results)
Actual result
Query returned zero results
Additional information
This is only happening when I filter on the Id field trying to match it with the list of Ids. If I use the list of Ids to exclude from the results then it will return some results. I also tried it with a different text field and it worked fine. Examples below:
This Works (notice the “NOT IN”)
SELECT Name FROM Product2 WHERE Id NOT IN ( '01t1X000005P61TQAS', '01t1X0000062jnyQAA', '01t0J00000F4ItSQAV', '01t1X000005P6vXQAS', '01t5I000000AS28QAG', '01t1X000005P7HdQAK', '01t1X0000062uXeQAI' )
This Works (changed to Name field)
SELECT Name FROM Product2 WHERE Name IN ( 'product_1', 'product_2', 'product_3', 'product_4' )
SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
sfdx-cli/7.84.2-a2868a68d5 win32-x64 node-v12.18.3
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core):
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.1 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.5 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.5 (core)
analytics 1.12.1 (core)
auth 1.4.6 (core)
config 1.2.3 (core)
generator 1.1.3 (core)
salesforcedx 50.13.3 (core)
├─ user 1.0.5 (core)
├─ schema 1.0.3 (core)
├─ limits 1.0.2 (core)
├─ templates 50.4.0 (core)
├─ salesforce-alm 50.13.1 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
├─ custom-metadata 1.0.11 (core)
└─ apex 0.1.4 (core)
sfdx-cli 7.84.2 (core)
OS and version:
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.17763 Build 17763
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (8 by maintainers)
Wow, great detective work. I’ll take a look and see why that’s happening. That’s one of our new OSS repos, you can see where/why it’s doing it here https://github.com/salesforcecli/data/blob/0ac477e3dcad5c4bf61f4e85b131b05c37d6af37/packages/plugin-data/src/api/data/tree/exportApi.ts#L118 I’ll fix it. just pretty cool to see!
Getting the same error still.