Notes on creating a scratchorg project from a set of metadata in a sandbox org

notes on how to create a scatch org with content from sandbox.

  • Step 1: create an outbound changeset in your sandbox.
  • Step 2: run sfdx force:org:list to check what your default (D) hub is
  • Step 3: if this is the wrong hub run sfdx force:config:set defautltdevhubusername=xxx — global (xxx set as the username of the hub to use). Re-run step 2 to check all ok
  • Step 4: create your skelton project with sfdx force:project:create –projectname XXXX where XXXX is the name of the project (and the directory that is created)
  • Step 5: Open in VSCode to monitor changes
  • Step 6: update /config/project-scratch-def.json. Add “s1EncryptedStoragePref2”: false to the settings areas to remove lightningExperience caching
  • Step 7: create a folder called mdapipackage in the project
  • Step 8: Now to pull the content from the sandbox we need to login to sandbox and have an alias sfdx force:auth:web:login -r -a Sandboxname
  • Step 9: Check that this is now in the org list sfdx force:org:list
  • Step 10: retrieve the changeset in mdapi format sfdx force:mdapi:retrieve -r retrieve -p ChangeSet -u username
  • Step 11: Check that this creates a file called in a retrieve directory
  • Step 12: unzip the
  • Step 13: run the command to convert to the SFDX project fomat (run from the base project directory). sfdx force:mdapi:convert -r mdapipackage/retrieve/ChangeSet
  • Step 14: Check that you have new content in your main project folder (force-app) and if so remove the mdapipackage folder
  • Step 1: Login to github and create a new repository
  • Step 2: git init
  • Step 3: git add .
  • Step 4: git commit –message “Initial Commit”
  • Step 5: git remote add origin
  • Step 6: git push origin master
  • Step 1: Create new scratch org sfdx force:org:create –setdefaultusername –setalias Alias –definitionfile config/project-scratch-def.json -d 5 -s
  • Step 2: check org created sfdx force:org:list (check D and U against the correct devhub and scracthorg)
  • Step 2: sfdx force:source:push
  • Step 1: sfdx force:source:convert -d mdapioutput/
  • Step 2: sfdx force:mdapi:deploy -d mdapioutput/ -u ScratchOrg

Leave a Reply

Your email address will not be published. Required fields are marked *