forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
486 stars 78 forks source link

force:data:soql:query prints [object Object] for related related record #264

Closed YodaDaCoda closed 3 years ago

YodaDaCoda commented 4 years ago

Summary

When querying data with sfdx force:data:soql:query, related fields more than two levels deep just display as [object Object].

Steps To Reproduce:

  1. sfdx force:data:soql:query -q "SELECT Id, Sobj1__r.Sobj2__r.Some_Field__c
  2. Note that the output fields are Id and Sobj1__r.Sobj2__r. The value for Sobj1__r.Sobj2__r is [object Object] which is the standard javascript string representation of an object.

Expected result

I should get the value of Id and Some_Field__c in my output.

Actual result

I get the Id and [object Object] in my output.

Additional information

I wrote a patch for the to process columns recursively, which is working beautifully for me, but I don't know if it'll be of any use to you internally. See attached: dataSoqlQueryCommand.patch.txt

SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.36.0-b1c4e9c7c8 linux-x64 node-v10.15.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core) @oclif/plugin-commands 1.2.3 (core) @oclif/plugin-help 2.2.1 (core) @oclif/plugin-not-found 1.2.3 (core) @oclif/plugin-plugins 1.7.8 (core) @oclif/plugin-update 1.3.9 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.0.5 (core) analytics 1.2.1 (core) generator 1.1.1 (core) salesforcedx 47.9.0 (core) ├─ salesforcedx-templates 47.9.0 (core) └─ salesforce-alm 47.10.0 (core)

sfdx-cli 7.36.0 (core)

OS and version: Ubuntu 19.10 (eoan)

clairebianchi commented 4 years ago

@YodaDaCoda We are going to look into this issue. Thank you

tescalada commented 3 years ago

Thanks so much for this patch @YodaDaCoda. I've been applying this patch to workaround this issue successfully for the past year until today. It seems to have broken at version sfdx-cli/7.84.2-a2868a68d5 linux-x64 node-v12.18.3 which has changed enough to break it. Attached is a new diff that seems to work for me (hopefully its not breaking something else that I have just not yet run into).

dataSoqlQueryCommand.7.84.2.patch.txt

WillieRuemmele commented 3 years ago

Hi @YodaDaCoda @tescalada check out the announcement for the new data plugin

mshanemc commented 3 years ago

I think this is fixed in the new data plugin released 4/1. If not, re-open or create a new case.

tescalada commented 3 years ago

@YodaDaCoda I ported your patch over to the new data plugin so I could continue making some deep queries. Feel free to fork and submit the patch upstream as it was your code to begin with. If that's more trouble than its worth and you want me to submit the patch let me know, I am happy to do that too with your approval.

MuriloKakazu commented 3 years ago

@mshanemc This is not fixed in @salesforce/plugin-data@0.6.0, which is currently the latest version of the plugin :(

image

MuriloKakazu commented 3 years ago

@clairebianchi @WillieRuemmele 👆

uip-robot-zz commented 3 years ago

This issue has been linked to a new work item: W-9733069