We’ve recently started adopting Salesforce DX and we’re trying to figure out the best way to spin up Scratch orgs.
As of now, we have multiple managed packages from the AppExchange installed in production, including
Marketing Cloud Connectand
Cirrus Insightand we would like to make certain scratch orgs have them.
I know there is a way to install packages with the
sfdx force:package:installcommand, but is there any way to do it via configuration so that we don’t have to execute a certain set of commands everytime we create a scratch org?
In case you prefer to install the package in a script, you could do it like this:
#login to your DevHub sfdx force:auth:jwt:grant --clientid [consumerKey] --username [devHubUserName] --jwtkeyfile assets/server.key --setdefaultdevhubusername #create scratch sfdx force:org:create -v [devHubUserName] -s -f [config/project-scratch-def.json] -a [scratchOrgName] #push source to scratch sfdx force:source:push -u [scratchOrgName] #install package sfdx force:package:install -i [packageId] -w 30 -u [scratchOrgName]