1

How to set username for the scratch org when you create it? When I create a scratch org using command sfdx force:org:create -s -f config/project-scratch-def.json -a ebikes I was able to get the scratch org Id along with different user name instead of different user name I want my user name to be set.

How is it possible?

  • Do you mean that you want to use an existing user name from an existing Salesforce org? – Thomas Taylor Jul 9 '19 at 18:28
  • No. I when I give the above command I want new scratch org to be created but with the user name I need.But When I give the above command new scratch org is created but with the random user name and is redirected to some other salesforce account , it is not mine actually. – user70573 Jul 11 '19 at 4:33
1

My assumption is that this is not possible.

If you need a specifically named user, create that user after the scratch org has been created.

Adding --json to sfdx force:org:create returns a JSON object with the username field in the username property if your problem is just that you need the name in later logic.

| improve this answer | |
  • actually when I push source into that newly generated scratch org, its taking me to different salesforce account (url) which I dont need.I am new to Salesforce.I am working on Lightning web component basics(push and deploy web component files) – user70573 Jul 9 '19 at 10:26
  • I not only need name I specify, I need my account to be opened when I give sfdx:org:open. It should be redirected to my account. – user70573 Jul 11 '19 at 4:35
  • That's just not how scratch orgs work. If you want to use a Developer or Sandbox org, then you authenticate to that with the JWT or Web auth methods and then use force:source: deploy & force:source:retrieve to move the metadata in and out. – Thomas Taylor Jul 12 '19 at 22:45

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.