Skip to content

Environment Setup

John M. Daniel edited this page Nov 26, 2023 · 20 revisions

How To Setup Salesforce DX Scratch Org

Create a DX Scratch Org

There are no special requirements with regards to the type of Salesforce scratch org needed to support this project.... just that one is created.

For the remainder of these instructions, we will assume that the your Scratch org alias is "myScratchOrg".

Install All Frameworks

As mentioned elsewhere, this codebase is dependent on other open source frameworks. These include:

Prerequisites

Using the Salesforce CLI custom plugin "shane-sfdx-plugins" will be the simplest way to accomplish this. If you need to install this plugin, execute the following:

  • sf plugins install shane-sfdx-plugins

Setup the scratch org

  • sf org create scratch --wait 30 --duration-days 2 --definition-file config/project-scratch-def.json --alias myScratchOrg

Each of the following frameworks must be installed before the source code from this project can be deployed to a scratch org.

Install ApexMocks

Install the fflib-apex-mocks project

  • sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks --targetusername myScratchOrg

Install Apex Common

Install the fflib-apex-commons project

  • sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common --path sfdx-source/apex-common --targetusername myScratchOrg

Install Force-DI

Install the force-di project

  • sf shane github src install --convert --githubuser apex-enterprise-patterns --repo force-di --path force-di --targetusername myScratchOrg

Here is the full command list:

sf org create scratch --wait 30 --duration-days 2 --definition-file config/project-scratch-def.json --alias myScratchOrg 
sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks --targetusername myScratchOrg
sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common --path sfdx-source/apex-common --targetusername myScratchOrg
sf shane github src install --convert --githubuser apex-enterprise-patterns --repo force-di --path force-di --targetusername myScratchOrg

Install The AT4DX code

Simply push the code to the scratch org

  • sf project deploy start