I need to define the MultiCurrency (MC) feature of the scratch org using CLI, not project-scratch-def.json file. Does anyone know if this is possible? I am running unit tests runs for all our code, one in an org with MC enabled, one in non-MC enabled org; therefore, I cannot touch the scratch org definition's json file.

thank you!


You're allowed to have multiple scratch org definition files in your project, and you're allowed to run your unit tests in more than one scratch org in parallel. This makes it easy to test your code in various different environments without performing messy, expensive, or side-effect-heavy configuration operations in a "dirty" environment - you always start fresh.

For your use case, I would suggest creating two definitions - say scratch-def-mc.json and scratch-def-no-mc.json, one defining a multicurrency org and the other not.

Then, you can create two scratch orgs:

sfdx force:org:create -f config/scratch-def-mc.json -a mc
sfdx force:org:create -f config/scratch-def-no-mc.json -a no-mc

Push your source to both orgs, run your tests in both orgs, and then delete both orgs.

I have an example showing how to run parallel SFDX builds on different scratch org definitions, using CircleCI, available on my GitHub.

  • thank you David! Why do we need to delete scratch orgs after we run tests? – Seyitbek Feb 27 at 17:29
  • @Seyitbek Strictly, you don't, and if you're working from your desktop you might keep them and reuse them. I like to always delete them and start each test run in a completely clean environment. If you're in a CI context, you'll delete them after every run. – David Reed Feb 27 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.