Deploy the following metadata additions to standard object "ScratchOrgInfo" which includes custom fields, a validation rule, and a workflow to a DevHub as pre-requisites to enable the associated scratch org pool commands to work.
Note: The sfpower-scratchorg-pool has been created as an Org-Dependent Unlocked Package instead of an Unlocked Package due to the ScratchOrgInfo Object being only available in Production or Developer Edition Orgs/Trial Orgs that have DevHub enabled.
There are multiple options to install the supporting package to your environment
-
Installing the Org-Dependent Unlocked Package to your DevHub from URL
1. Login to your DevHub 2. Navigate to https://login.salesforce.com/packaging/installPackage.apexp?p0=04t1P000000katQQAQ to install the **sfpower-scratchorg-pool** unlocked package into your DevHub. 3. Select **Install for Admin Only**
-
Installing the Org-Dependent Unlocked Package to your DevHub using CLI
sfdx force:package:install -p 04t1P000000katQQAQ -u <Devhub> -r -a package -s AdminsOnly -w 30
If you need to satisfy any compliance issues, such as installing third party packages are not permitted in production, you can utilize the below mechanisms. Please note that when you do this, any further updates have to be manually synced up
-
Build an Org Depedendent Unlocked Package in your DevHub and deploy it
1. git clone https://github.com/dxatscale/sfpowerscripts 2. cd sfpowerscripts/prerequisites/scratchorgpool 3. sfdx force:package:create -n sfpower-scratchorg-pool -t Unlocked -r force-app -v <devhub_alias> --orgdependent 4. sfdx force:package:version:create -p sfpower-scratchorg-pool -x -v <devhub_alias> -w 30 5. Observe the package id created in sfdx-project.json 6. sfdx force:package:install -p <packageVersionId> -u <devhub_alias> -w 30
In order to upgrade from 1.1.0-1 to 2.0.0-1 the Picklist value 'Return' needs to be added to the 'Allocation_Status__c'
First install the new version of the package in your DevHub:
sfdx force:package:install --package
-u <devhub_alias> -r -a package -s AdminsOnly -w 30
Second, add the new picklist value using either the CLI or the Setup menu
Update through the CLI:
-
git clone https://github.com/dxatscale/sfpower-scratchorg-pool.git
-
Use force:source:deploy command to deploy the required field
sfdx force:source:deploy -p sfpower-scratchorg-pool/force-app/main/default/objects/ScratchOrgInfo/fields/Allocation_status__c.field-meta.xml -u <devhub_alias> -l RunSpecifiedTests -r skip
Update through Setup Menu:
- Go to Setup -> Object Manager
- Select 'ScratchOrgInfo'
- Go to 'Fields and Relationships'
- Select 'Allocation_Status__c'
- Add a new value 'Return'
- Your picklist values should reflect the below screenshot
-
git clone https://github.com/dxatscale/sfpower-scratchorg-pool.git
-
Deploy using force:source:deploy with a destructive manifest supplied
sfdx force:source:deploy -p force-app/main/default/objects/ScratchOrgInfo/fields/Allocation_status__c.field-meta.xml -u <devhub_alias> -l RunSpecifiedTests -r skip --predestructivechanges destructive-changes/pre-deploy-destructive-changes.xml
Update the existing source code within your package locally and create a new package version using:
sfdx force:package:version:create -p sfpower-scratchorg-pool -x -v <devhub_alias> -w 30