Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sf cmdt generate records sometimes does bad file endings #2573

Closed
Windyo opened this issue Nov 16, 2023 · 9 comments
Closed

sf cmdt generate records sometimes does bad file endings #2573

Windyo opened this issue Nov 16, 2023 · 9 comments
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@Windyo
Copy link

Windyo commented Nov 16, 2023

Summary

Using sf via the command line, running sf cmdt generate records --csv .\config\data\myfile.csv --type-name Table__mdt, where the csv contained thirty records, resulted in 4 of these records having bad endings ranging from </CustomMetadata>adata> to </CustomMetadata>adata>ata>ata> and </CustomMetadata>adata>

Steps To Reproduce

1/ have a csv file
2/ generated cmdt records
3/ observe the file endings

This seems to happen if the same line exists multiple times in the csv with different values in some columns - so it can be chalcked up to data quality, but is still a bug

Expected result

the command generates valid files

Actual result

It generates bad endings.

System Information

cmd.exe on windows latest with updated sf.cli

@Windyo Windyo added the investigating We're actively investigating this issue label Nov 16, 2023
Copy link

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.

Copy link

Hello @Windyo 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue.
    • A repository that clearly demonstrates the bug is ideal.
  • Make sure you've installed the latest version of Salesforce CLI. (docs)
    • Better yet, try the rc or nightly versions. (docs)
  • Try running the doctor command to diagnose common issues.
  • Search GitHub for existing related issues.

Thank you!

@github-actions github-actions bot added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Nov 16, 2023
@Windyo
Copy link
Author

Windyo commented Nov 16, 2023

{
"architecture": "win32-x64",
"cliVersion": "@salesforce/cli/2.17.14",
"nodeVersion": "node-v20.9.0",
"osVersion": "Windows_NT 10.0.19045",
"rootPath": "C:\Users\Geoffrey\AppData\Local\sf\client\2.17.14-31db5eb",
"shell": "cmd.exe",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.0.1 (core)",
"@oclif/plugin-commands 3.0.6 (core)",
"@oclif/plugin-help 6.0.5 (core)",
"@oclif/plugin-not-found 3.0.3 (core)",
"@oclif/plugin-plugins 4.1.7 (core)",
"@oclif/plugin-search 1.0.6 (core)",
"@oclif/plugin-update 4.1.3 (core)",
"@oclif/plugin-version 2.0.6 (core)",
"@oclif/plugin-warn-if-update-available 3.0.2 (core)",
"@oclif/plugin-which 3.0.8 (core)",
"@salesforce/cli 2.17.14 (core)",
"apex 2.3.20 (core)",
"auth 2.8.26 (core)",
"custom-metadata 2.2.12 (user)",
"data 2.6.3 (core)",
"deploy-retrieve 1.20.0 (core)",
"info 3.0.1 (core)",
"limits 3.0.1 (core)",
"login 2.0.1 (core)",
"marketplace 1.0.2 (core)",
"org 2.11.8 (core)",
"schema 3.0.1 (core)",
"settings 2.0.2 (core)",
"sobject 0.2.15 (core)",
"source 2.11.0 (core)",
"telemetry 3.1.0 (core)",
"templates 55.5.18 (core)",
"trust 3.0.2 (core)",
"user 2.3.42 (core)",
"sfdx-git-delta 5.28.0 (user)"
]
}

@github-actions github-actions bot added validated Version information for this issue has been validated investigating We're actively investigating this issue and removed more information required Issue requires more information or a response from the customer labels Nov 16, 2023
@mshanemc
Copy link
Contributor

@Windyo have you got a sample csv for repro?

@Windyo
Copy link
Author

Windyo commented Nov 16, 2023 via email

@mshanemc
Copy link
Contributor

mshanemc commented Nov 16, 2023

@Windyo not the real data, but some junk that would cause the error.

If not, can you explain what you mean by

if the same line exists multiple times in the csv with different values in some columns

@Windyo
Copy link
Author

Windyo commented Nov 16, 2023

I managed to get one.

Name,TelelinkInvoicingCompany__c,TelelinkCountryCodePick__c,TelelinkCountryGroupCode__c,TelelinkPostalCodeStart__c,TelelinkPostalCodeEnd__c,TelelinkVatSubjectCode__c,TeleLinkCode__c
17 - FOO BAAAR BAR FOOO,FOO BARBAR, ,BAR, , ,1 - BAR + Foo,17 - FOO BAAAR BAR FOOO
17 - FOO BAAAR BAR FOOO,FOO BARBAR, ,BAR, , ,4 - FOOBar,17 - FOO BAAAR BAR FOOO
17 - FOO BAAAR BAR FOOO,FOO BARBAR, ,FOO, , ,1 - BAR + Foo,17 - FOO BAAAR BAR FOOO
17 - FOO BAAAR BAR FOOO,FOO BARBAR, ,FOO, , ,4 - FOOBar,17 - FOO BAAAR BAR FOOO

This will generate an xml that ends in </CustomMetadata>ta>

Note the fact that technically, every line overwrites the same XML file because the Name is the same.
In my case, this was because I had not generated the Name properly, but in real-world situations having un-sane data where duplicates happen should not result in broken xml files.

@mshanemc mshanemc added the bug Issue or pull request that identifies or fixes a bug label Nov 17, 2023
Copy link

git2gus bot commented Nov 17, 2023

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

@Windyo
Copy link
Author

Windyo commented Nov 29, 2023

This seems to be in a merged PR - should we close this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants