cli icon indicating copy to clipboard operation
cli copied to clipboard

sfdx force:data:soql:query merges relationship fields and do not display any value

Open somyasrivas opened this issue 3 years ago • 2 comments

Summary

When querying data with sfdx force:data:soql:query, relationship fields get combined and do not display any value in the output. If single relationship fields exist then it displays properly, but if there is more than 1 relationship field in the query, then both fields get combined and do not display any value.

Steps To Reproduce:

  1. sfdx force:data:soql:query -q "SELECT CreatedDate , Sobject1__r.Sobject2__r.Some_Field1__c, Sobject1__r.Sobject2__r.Some_Field2__c" -u username -r csv

ex: sfdx force:data:soql:query -q "SELECT Id, Opportunity.Account.Name, Opportunity.Account.OwnerId FROM OpportunityHistory" -u [email protected] -r csv

  1. Note that the output fields are CreatedDate and Sobject1__r.Sobject2__r.Some_Field1__c.Some_Field2__c The value for Sobject1__r.Sobject2__r.Some_Field1__c.Some_Field2__c is blank

Expected result: I should get the value of Id and Sobject1__r.Sobject2__r.Some_Field1__c, Sobject1__r.Sobject2__r.Some_Field2__c in my output.

Actual result: I get the Id and Sobject1__r.Sobject2__r.Some_Field1__c.Some_Field2__c column and value for 2nd column blank in my output.

output
  1. Remove any one of the relationship fields from the query, then it displays the correct result: ex: sfdx force:data:soql:query -q "SELECT Id, Opportunity.Account.Name FROM OpportunityHistory" -u [email protected] -r csv

System Information

  • Run sfdx version --verbose --json:

{ "cliVersion": "sfdx-cli/7.142.1", "architecture": "win32-x64", "nodeVersion": "node-v16.14.0", "pluginVersions": [ "@oclif/plugin-autocomplete 0.3.0 (core)", "@oclif/plugin-commands 1.3.0 (core)", "@oclif/plugin-help 3.3.1 (core)", "@oclif/plugin-not-found 1.2.6 (core)", "@oclif/plugin-plugins 1.10.11 (core)", "@oclif/plugin-update 1.5.0 (core)", "@oclif/plugin-warn-if-update-available 1.7.3 (core)", "@oclif/plugin-which 1.0.4 (core)", "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
"alias 1.2.1 (core)", "apex 0.11.0 (core)", "auth 1.8.1 (core)", "community 1.1.4 (core)", "config 1.3.23 (core)", "custom-metadata 1.0.12 (core)", "data 0.6.9 (core)", "generator 1.2.2 (core)", "info 1.3.0 (core)", "limits 1.3.0 (core)", "org 1.11.2 (core)", "salesforce-alm 54.0.1 (core)", "schema 1.1.0 (core)", "sfdx-cli 7.142.1 (core)", "source 1.8.18 (core)", "telemetry 1.4.0 (core)", "templates 54.2.0 (core)", "trust 1.1.0 (core)", "user 1.7.1 (core)" ], "osVersion": "Windows_NT 10.0.19042" }

version

Similar discussion: https://trailhead.salesforce.com/en/trailblazer-community/feed/0D54S00000EAb6vSAD

somyasrivas avatar Apr 11 '22 06:04 somyasrivas

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] avatar Apr 11 '22 06:04 github-actions[bot]

Associated work item: W-10977978

shetzel avatar Apr 11 '22 21:04 shetzel