SalesforceDX + Visual Studio Code + ForceCode: Powershell Script zum Setzen von Scratch Org Login und Passwort

# existing force.json and default scratch org are a prerequesites
sfdx force:user:password:generate  
$myOrg = (sfdx force:org:display --json | ConvertFrom-Json).result
$forceConfig = Get-Content .\force.json -Raw | ConvertFrom-Json
$forceConfig.url = $myOrg.instanceUrl
$forceConfig.username = $myOrg.username
$forceConfig.password = $myOrg.password
$forceConfig.apiVersion = "40.0"
$forceConfig | ConvertTo-Json | Out-File -FilePath force.json -Encoding utf8

Link zum Gist

Show Comments