6

BACKGROUND

Imagine you're working on 2-3 Salesforce projects each with a different target Orgs (sandboxes for different companies).

You're actively working on project 1 (coding, running tests, deploy source to the org etc) and in parallel to this, you need to make a couple of tweaks to project 2 and project 3 during the same time period.

Therefore you have 3 instances of Visual Studio Code open.

I realise I could run this command to tell SFDX which org is the default

sfdx force:config:set defaultusername=ALIAS_NAME

or

sfdx force:config:set defaultusername=name@example.com

QUESTION

Is there a setting in the project-scratch-def.json that will tell Visual Studio Code which Org it should run the Salesforce DX against?

3

When you run sfdx force:config:set the value is set at the project level unless you use the -g flag. So running sfdx force:config:set defaultusername=alias in a project folder will make that the default org for the project and the commands that you run in vscode will respect that.

  • 1
    Thanks. So let me get this straight, I can set the defaultusername on a per folder basis? – Robs Sep 8 '18 at 13:06
  • 1
    That's correct. When you set a config value (including defaultusername) without the -g flag, the value is stored in the .sfdx\sfdx-config.json file in your project directory and used only for that project. – John Towers Sep 8 '18 at 13:12

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.