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: Underscore replacement for filename only happens once #2158

Closed
chris-duncan-adaptiva opened this issue May 23, 2023 · 5 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@chris-duncan-adaptiva
Copy link

chris-duncan-adaptiva commented May 23, 2023

Summary

The command sf cmdt generate records will create custom metadata records from a CSV, and part of that process is indicating a column used for the MasterLabel field which is also translated to the DeveloperName field via the generated filename. However, while underscores should replace every non-alphanumeric character into underscores, and leading digits prefixed with an X, only the first space is replaced with an underscore, and other characters are ignored.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc-2158

NOTE: If your issue is not reproducable by dreamhouse-lwc, i.e. requires specific metadata or files, we require a link to a simple Salesforce project repository with a script to setup a scratch org that reproduces your problem.
https://github.com/chris-duncan-adaptiva/dreamhouse-lwc-2158/blob/main/bin/install-scratch.sh

  1. Create a custom metadata type (e.g. "Test").
  2. Create a CSV with a column for MasterLabel.
  3. Add a row to the CSV where the value for MasterLabel is "7test(this) cmdt bug"
  4. Execute sf cmdt generate records --csv <CSV_PATH_HERE> --type-name <MDT_HERE> --name-column MasterLabel replacing arguments in brackets <> as appropriate.

Expected result

Filename is transformed as if entered via the Setup UI, which leading digits prefixed by the letter 'X' and non-alphanumeric characters replaced with underscores. (From our example above it should become Test.X7test_this_cmdt_bug.md-meta.xml).

Actual result

Filename is only transformed to substitute the first space in the label with an underscore. Leading digits are not prefixed with 'X' and non-alphanumeric characters after the first space are left unchanged.

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.)
    bash

  • If you are using sfdx

    • Run sfdx version --verbose --json
  • If you are using sf

    • Run sf version --verbose --json
      {
      "cliVersion": "@salesforce/cli/1.78.6",
      "architecture": "win32-x64",
      "nodeVersion": "node-v18.14.2",
      "osVersion": "Windows_NT 10.0.22621",
      "shell": "cmd.exe",
      "rootPath": "C:\Users\ChrisDuncan\AppData\Roaming\nvm\v18.14.2\node_modules\@salesforce\cli",
      "pluginVersions": [
      "@oclif/plugin-autocomplete 2.2.0 (core)",
      "@oclif/plugin-commands 2.2.15 (core)",
      "@oclif/plugin-help 5.2.9 (core)",
      "@oclif/plugin-not-found 2.3.23 (core)",
      "@oclif/plugin-plugins 3.0.1 (core)",
      "@oclif/plugin-search 0.0.17 (core)",
      "@oclif/plugin-update 3.1.14 (core)",
      "@oclif/plugin-version 1.3.4 (core)",
      "@oclif/plugin-warn-if-update-available 2.0.36 (core)",
      "@oclif/plugin-which 2.2.20 (core)",
      "@salesforce/cli 1.78.6 (core)",
      "apex 2.2.17 (core)",
      "auth 2.7.15 (core)",
      "custom-metadata 2.1.20 (user)",
      "data 2.3.16 (core)",
      "deploy-retrieve 1.8.20 (core)",
      "env 2.1.6 (user)",
      "functions 1.21.7 (user)",
      "info 2.6.10 (core)",
      "limits 2.3.14 (core)",
      "login 1.2.8 (core)",
      "org 2.8.2 (core)",
      "packaging 1.15.0 (user)",
      "schema 2.3.10 (core)",
      "settings 1.4.6 (core)",
      "signups 1.4.6 (user)",
      "sobject 0.1.18 (core)",
      "source 2.10.7 (core)",
      "telemetry 2.2.0 (core)",
      "templates 55.4.13 (core)",
      "trust 2.4.16 (core)",
      "user 2.3.10 (core)"
      ]
      }

Additional information

Feel free to attach a screenshot.

@chris-duncan-adaptiva chris-duncan-adaptiva added the investigating We're actively investigating this issue label May 23, 2023
@github-actions
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.

@iowillhoit iowillhoit added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels May 24, 2023
@git2gus
Copy link

git2gus bot commented May 24, 2023

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

@iowillhoit
Copy link
Contributor

Thank you @chris-duncan-adaptiva for the excellent repo to reproduce the problem ❤ I've got a fix coming here soon!

@iowillhoit
Copy link
Contributor

iowillhoit commented May 25, 2023

Alright, has been merged and will be available in tomorrow's nightly release. Thanks!

@cristiand391
Copy link
Member

this was fixed in sf v1.81.0.
https://github.com/forcedotcom/cli/tree/main/releasenotes/sf#1810-june-7-2023-stable

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
Projects
None yet
Development

No branches or pull requests

3 participants