env Commands
env compute collaborator add
Examples for env compute collaborator add
Add a Heroku user as a collaborator on this Functions account.
1sf env compute collaborator add --heroku-user example@heroku.comUsage
- sf env compute collaborator add
- -h HEROKU-USER
Flags
- -h | --heroku-user HEROKU-USER
- Required
-
Email address of the Heroku user you're adding as a collaborator.
- Type: option
env create compute
Description for env create compute
Compute environments must be connected to a Salesforce org. By default the command uses your local environment's connected org. Use the '--connected-org' flag to specify a specific org. Run 'sf env list' to see a list of environments.
Examples for env create compute
Create a compute environment to run Salesforce Functions:
1sf env create computeConnect the environment to a specific org:
1sf env create compute --connected-org=org-aliasCreate an alias for the compute environment:
1sf env create compute --alias environment-aliasUsage
- sf env create compute
- [-o CONNECTED-ORG]
- [-a ALIAS]
Flags
- -o | --connected-org CONNECTED-ORG
- Optional
-
Username or alias for the org that the compute environment should be connected to.
- Type: option
- -a | --alias ALIAS
- Optional
-
Alias for the created environment.
- Type: option
env delete
Description for env delete
You must include the name of the environment to delete using '--target-compute'. Run 'sf env list' to see a list of environments.
Running this command will prompt a confirmation. If you want to skip this confirmation, use the '--confirm' flag and the environment alias to skip confirmation.
Examples for env delete
Delete a compute environment:
1sf env delete --target-compute environment-aliasDelete without a confirmation step:
1sf env delete --target-compute environment-alias --confirm environment-aliasUsage
- sf env delete
- [-e TARGET-COMPUTE]
- [--confirm CONFIRM]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option
- --confirm CONFIRM
- Optional
-
Confirmation name.
- Type: option
env display
Description for env display
Specify an environment with either the username you used when you logged into the environment with "sf login", or the alias you gave the environment when you created it. Run "sf env list" to view all your environments and their aliases.
Output depends on the type of environment. For example, scratch org details include the access token, alias, username of the associated Dev Hub, the creation and expiration date, the generated scratch org username, and more. Compute environment details include the alias, connected orgs, creation date, project name, and more.
Examples for env display
Display details about a scratch org with alias my-scratch-org:
1sf env display --target-env=my-scratch-orgSpecify a username instead of an alias:
1sf env display --target-env=test-123456-abcdefg@example.comSpecify JSON format and redirect output into a file:
1sf env display --target-env=my-scratch-org --json > tmp/MyOrdDesc.jsonUsage
- sf env display
- [--json]
- [-e TARGET-ENV]
Flags
- --json
- Optional
-
Format output as json.
- Type: boolean
- -e | --target-env TARGET-ENV
- Optional
-
Environment alias or login user.
- Type: option
env list
Description for env list
By default, the command displays active environments. For orgs, active means unexpired scratch orgs and orgs you’re currently logged into.
Output is displayed in multiple tables, one for each environment type. For example, the Salesforce Orgs table lists the non-scratch orgs you’re logged into, such as sandboxes, Dev Hubs, production orgs, and so on. Scratch orgs and compute environments get their own tables.
The two org tables show similar information, such as aliases, information about the org, and how you authorized (logged into) it, such as with a web browser or JWT. The scratch org table also shows the expiration date. For non-scratch orgs, the Username column refers to the user you logged into the org with. For scratch orgs it refers to the username that was generated for you when you created the scratch org. Your default scratch org or Dev Hub org is indicated with the "target-org" or "target-dev-hub" configuration variable, respectively, in the Config column.
The compute environment table shows the alias, information about the connected orgs, the project name, and more.
Use the table manipulation flags, such as --filter and --sort, to change how the data is displayed.
Run "sf env display" to view details about a specific environment.
Examples for env list
List all active environments:
1sf env listList both active and inactive environments:
1sf env list --allFilter the output to list only orgs you authorized using a web browser; "Auth Method" is the name of a column:
1sf env list --filter "Auth Method=web"Display only the Aliases column and sort the aliases in descending order:
1sf env list --sort "-Aliases" --columns "Aliases"Don't truncate the displayed output and instead wrap text that's wider than your terminal:
1sf env list --no-truncateDisplay only the table data, not the headers, in comma-separated value (csv) format:
1sf env list --csv --no-headerUsage
- sf env list
- [--json]
- [-a]
- [--columns COLUMNS]
- [--csv]
- [--filter FILTER]
- [--no-header]
- [--no-truncate]
- [--output OUTPUT]
- [--sort SORT]
Flags
- --json
- Optional
-
Format output as json.
- Type: boolean
- -a | --all
- Optional
-
Show all environments, even inactive ones.
- Type: boolean
- --columns COLUMNS
- Optional
-
List of columns to display.
- Type: option
- --csv
- Optional
-
Output in csv format [alias: --output=csv]
- Type: boolean
- --filter FILTER
- Optional
-
Filter property by partial string matching.
- Type: option
- --no-header
- Optional
-
Hide table header from output.
- Type: boolean
- --no-truncate
- Optional
-
Don't truncate output to fit screen.
- Type: boolean
- --output OUTPUT
- Optional
-
Format in which to display the output.
- Type: option
- Permissible values are: csv, json, yaml
- --sort SORT
- Optional
-
Column to sort by (prepend '-' for descending).
- Type: option
env logdrain add
Description for env logdrain add
Both '--target-compute' and '--url' are required flags. '--url' should be a HTTP or HTTPS URL that can receive the log drain messages.
Examples for env logdrain add
Add a log drain:
1sf env logdrain add --target-compute environment-name --url https://path/to/logdrainUsage
- sf env logdrain add
- [-e TARGET-COMPUTE]
- [-l DRAIN-URL]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option
- -l | --drain-url DRAIN-URL
- Optional
-
Endpoint that will receive sent logs.
- Type: option
env logdrain list
Examples for env logdrain list
List log drains:
1sf env logdrain list --target-compute environment-aliasList log drains as json:
1sf env logdrain list --target-compute environment-alias --jsonUsage
- sf env logdrain list
- [-e TARGET-COMPUTE]
- [-j]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option
- -j | --json
- Optional
-
Output list in JSON format.
- Type: boolean
env logdrain remove
Description for env logdrain remove
Both '--target-compute' and '--drain-url' are required flags.
Examples for env logdrain remove
Remove a logdrain:
1sf env logdrain remove --target-compute environment-alias --url https://path/to/logdrainUsage
- sf env logdrain remove
- [-e TARGET-COMPUTE]
- [-l DRAIN-URL]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option
- -l | --drain-url DRAIN-URL
- Optional
-
Log drain url to remove.
- Type: option
env open
Description for env open
You can open the following types of environments in a web browser: scratch orgs, sandboxes, Dev Hubs, and production orgs. Run "sf env list" to view your environments and their aliases and login usernames.
Each of your environments is associated with an instance URL, such as https://login.salesforce.com. To open a specific web page, specify the portion of the URL after "<URL>/" with the --path flag, such as /apex/YourPage to open a Visualforce page.
Examples for env open
Open the Visualforce page /apex/StartHere in a scratch org with alias test-org:
1sf env open --target-env test-org --path /apex/StartHereView the URL but don't launch it in a browser:
1sf env open --target-env test-org --path /apex/StartHere --url-onlyOpen the environment in the Google Chrome browser:
1sf env open --target-env test-org --path /apex/StartHere --browser chromeUsage
- sf env open
- [--json]
- [-p PATH]
- [-r]
- [-e TARGET-ENV]
- [--browser BROWSER]
Flags
- --json
- Optional
-
Format output as json.
- Type: boolean
- -p | --path PATH
- Optional
-
Path to append to the end of the login URL.
- Type: option
- -r | --url-only
- Optional
-
Display the URL, but don’t launch it in a browser.
- Type: boolean
- -e | --target-env TARGET-ENV
- Optional
-
Login user or alias of the environment to open.
Specify the login user or alias that’s associated with the environment. For scratch orgs, the login user is generated by the command that created the scratch org. You can also set an alias for the scratch org when you create it.
For Dev Hubs, sandboxes, and production orgs, specify the alias you set when you logged into the org with "sf login".
- Type: option
- --browser BROWSER
- Optional
-
Browser in which to open the environment.
You can specify that the environment open in one of the following browsers: Firefox, Safari, Google Chrome, or Windows Edge. If you don’t specify --browser, the environment opens in your default browser. The exact names of the browser applications differ depending on the operating system you're on; check your documentation for details.
- Type: option
env var get
Description for env var get
You must provide the '--target-compute' flag and the key to retrieve.
Examples for env var get
Get a config variable:
1sf env var get [KEY] --target-compute environment-aliasUsage
- sf env var get
- [-e TARGET-COMPUTE]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option
env var list
Description for env var list
Use the '--json' flag to return config vars in JSON format.
Examples for env var list
List config vars:
1sf env var list --target-compute environment-aliasList in JSON format:
1sf env var list --target-compute environment-alias --jsonUsage
- sf env var list
- [-e TARGET-COMPUTE]
- [-j]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option
- -j | --json
- Optional
-
Output list in JSON format.
- Type: boolean
env var unset
Description for env var unset
Run 'sf env var list' to see a list of config values that can be unset.
Examples for env var unset
Unset a value:
1sf env var unset --target-compute environment-aliasUsage
- sf env var unset
- [-e TARGET-COMPUTE]
Flags
- -e | --target-compute TARGET-COMPUTE
- Optional
-
Environment name.
- Type: option