Connect and Prepare Your Development Environment

This Quick Start includes instructions for developing with scratch orgs. We recommend using a Dev Hub and scratch org for Salesforce Functions development. See Develop Functions Using Sandbox Orgs to incorporporate sandbox orgs into your functions development.

Connect to your Dev Hub, then connect to Salesforce Functions.

The Developer Hub (Dev Hub) lets you create and manage scratch orgs. The scratch org is a source-driven and disposable deployment of Salesforce code and metadata.

Confirm Dev Hub is Enabled

In your Dev Hub org, from Setup, enter "Dev Hub" in the Quick Find box. Select Dev Hub and make sure the "Enable Dev Hub" switch is toggled on.

See Configure Your Org for more information.

Login and Set an Alias To Your Dev Hub

Log in to your Dev Hub using your username and password.

  • -a set an alias for the authenticated org, which you use in subsequent CLI commands
  • -d set this org as the default org for all commands
  • -v set this org as the default Dev Hub for creating scratch orgs

In VS Code, from the command palette, select SFDX: Authorize a Dev Hub.

Log in to Salesforce Functions using the CLI.

The command sf login functions opens a browser page where you can log in to your Salesforce Functions account. Use the same credentials you used to connect your Dev Hub org.

After creating the scratch org, create a Salesforce compute environment that's associated with that org. Your functions deploy to this compute environment.

  • -o Alias of the org the compute environment is connected to
  • -a Alias for the newly created compute environment