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

Localized scratch orgs with defaultRecordTypes are only partially created since 60.0 #2731

Open
sanderott opened this issue Feb 19, 2024 · 4 comments
Labels
owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team. validated Version information for this issue has been validated

Comments

@sanderott
Copy link

Summary

This is a combination of 2 problems. We've had to combine them into one issue because we're unaware of any way to easily and reliably replicate the second part of the issue (org alias not being set on a partially created scratch org) other than with the first part of the issue.

  1. Generating a scratch org using language & country NL with a defaultRecordType configured for Opportunity breaks the 'Deploy Settings' step of the scratch org creation process, leaving the scratch org in a state where it has been created and is accessible, but hasn't been fully configured.

  2. As the scratch org generation process only partially succeeds, the org alias that was declared for the scratch org doesn't get assigned to said scratch org.

Steps To Reproduce

Unable to provide our company's private repo, but this bug has seemed consistently replicable through the steps below.

  • Generate a project with sf project generate
  • Update the project-scratch-def.json to include:
  "edition": "Enterprise",
  "language": "nl_NL",
  "country": "NL",
  "objectSettings":{
    "opportunity": {
      "sharingModel": "private",
      "defaultRecordType": "Donation"
    }
  }
  • Create a scratch org with sf org create scratch --alias "any-alias" --definition-file ./config/project-scratch-def.json --target-dev-hub "any-dev-hub" --wait 15 --track-source

Expected result

  • Scratch org should be created completely & successfully.
  • The provided argument for --alias should be assigned as the alias of the scratch org.

Actual result

  • The scratch org creation returns an error on step 'Deploy Settings':

Error (1): A scratch org was created with username test-lg8mkhvxloh8@example.com, but the settings failed to deploy due to:
[Error] Opportunity.DonationProcess : Picklist value: Prospecting not found

  • Despite having returned an error, the creation of the scratch org was not reversed or deleted, and it is accessible with sf org open through using the scratch org's username
  • The provided --alias is not assigned as alias to the scratch org. Since the creation of the scratch org was a partial success and the org is reachable, we would've expected the alias to have been set.
  • When checking the deployment status (NL: Implementatie status) in the scratch org's Setup, the 'Deploy Settings'-deployment shows as partially succeeded and shows the same error as shown in the CLI (picture included in additional information).

System Information

Problem has occurred on multiple shells we've used (bash, cmd)

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.28.6",
  "nodeVersion": "node-v20.11.0",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\Sander-CaseNine\\AppData\\Local\\sf\\client\\2.28.6-cb38ecf",
  "shell": "D:\\CLI\\Git\\usr\\bin\\bash.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.7 (core)",
    "@oclif/plugin-commands 3.1.2 (core)",
    "@oclif/plugin-help 6.0.12 (core)",
    "@oclif/plugin-not-found 3.0.10 (core)",
    "@oclif/plugin-plugins 4.2.1 (core)",
    "@oclif/plugin-search 1.0.13 (core)",
    "@oclif/plugin-update 4.1.10 (core)",
    "@oclif/plugin-version 2.0.12 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.10 (core)",
    "@oclif/plugin-which 3.0.15 (core)",
    "@salesforce/cli 2.28.6 (core)",
    "apex 3.0.22 (core)",
    "auth 3.3.11 (core)",
    "data 3.0.19 (core)",
    "deploy-retrieve 3.2.11 (core)",
    "info 3.0.21 (core)",
    "limits 3.1.7 (core)",
    "marketplace 1.0.20 (core)",
    "org 3.3.11 (core)",
    "packaging 1.27.1 (user)",
    "schema 3.1.1 (core)",
    "settings 2.0.22 (core)",
    "signups 2.0.20 (user)",
    "sobject 1.1.9 (core)",
    "source 3.1.10 (core)",
    "telemetry 3.1.11 (core)",
    "templates 56.0.13 (core)",
    "trust 3.3.6 (core)",
    "user 3.2.7 (core)"
  ]
}

Additional information

Various things we've already investigated and tried:

  • This problem came into existence once our DevHub hit API 60.0. This problem did not exist on API version 59.0 as we were able to confirm ourselves during the preview period using --release previous.
  • We've confirmed this problem exists when generating the scratch org either synchronously or asynchronously.
  • We've confirmed this problem exists generating the scratch org either with or without source tracking enabled.
  • We've confirmed this problem also exists for other languages (specifically using "language": "de_DE" and "country": "DE")
  • Curiously, the problem doesn't seem to occur on edition "edition": "Developer", but does on "edition": "Enterprise", as well as when using an 'Unlimited' edition Dev Hub as org shape.
  • The problem doesn't seem to tie to the specifics of the Dev Hub, but we're unable to verify that with 100% certainty.
  • The problem seems to specifically exist for object 'Opportunity'. Attempting to generate a default record type for Account worked without problem. We have not tried this with every other standard object though.
  • When generating a scratch org without a defaultRecordType for Opportunity the org gets created fully. However, the things noted in our hypothesis below still apply to that fully created scratch org as well, indicating that simply not having a default Record Type likely doesn't actually solve the underlying root issue.

Our hypothesis:
From looking into the partially created scratch orgs, the problem seems to lie specifically on Opportunity field StageName.
The labels and API values have all been translated to the language/country specified in the project-scratch-def:
image

On any other standard picklists, the labels were translated, but API values remained in English:
image

Note that in orgs generated on API 59.0 with identical settings, neither the labels nor (in case of Opportunity's StageName) API values for standard picklist were translated on creation of the scratch org. Both labels & API values were all in English.

Screenshot of the failed deployment in the generated scratch org:
image

Known bypass for people experiencing this problem:
For anyone experiencing this same issue, we were able to bypass this issue by making the following adjustments to our pipeline:

  • Removing defaultRecordType for Opportunity from our project-def-scratch.json file
  • Adding a special deployment to the scratch org immediately after org creation to deploy specifically an instance of the OpportunityStage standardValueSet containing the standard English API values that you'd normally get out-of-the-box on any EN scratch org (Prospecting, Qualification, etc.).
  • Continue as normal.
@sanderott sanderott added the investigating We're actively investigating this issue label Feb 19, 2024
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.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Feb 19, 2024
@mdonnalley
Copy link
Contributor

@sanderott Thanks for the detailed writeup!

This is likely an issue with the metadata api since the error started happening once you moved to v60. I'm going to leave this open and mark as owned by another team. Your best bet is to submit a support case since those are typically higher priority for the metadata team than github issues.

@mdonnalley mdonnalley added owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team. and removed investigating We're actively investigating this issue labels Feb 19, 2024
Copy link

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.

@sanderott
Copy link
Author

sanderott commented Apr 16, 2024

This problem has been identified as a bug and has been logged by Salesforce as issue W-15510248:
https://issues.salesforce.com/issue/a028c00000z0BcQ/scratch-org-are-created-without-def

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team. validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants