Set Up Your Development Environment
To develop and run Salesforce Functions, install development tools. The tools vary depending on the language you use.
To work with Salesforce Functions, install these tools:
npmversion 6.13.4 or higher.
- OpenJDK 8 or higher and Apache Maven 3.6.3 or higher to develop Functions that use Java.
- Git CLI or GUI client to track changes in your Function code. See Set up Git.
- (Optional) To push changes to GitHub, create a github.com account.
- (Optional) To save Function log output to a log drain, set up a log drain receiver or sign up with a service that can accept log drains. See Function Logging.
Salesforce CLI is a bundle of two executables:
sf executable is designed to eventually work across all Salesforce clouds. It contains all the Salesforce Functions-related commands and a handful of Salesforce Platform commands.
sfdx executable is focused on Salesforce Platform. For now, use both executables to create and deploy Salesforce Functions, as shown in the examples in this guide.
To get both executables, install Salesforce CLI.
Update to the latest version.
Run the update command even if you previously installed Salesforce CLI. Check the Salesforce CLI Release Notes for the most recent CLI versions.
Confirm you have
sfdxCLI version 7.148 or later.
sf versionand confirm you have version 1.25 or later.
sf plugins --coreand view the list of all installed plug-ins. Make sure the functions plugin is installed.
The output looks like this:
If your versions are still outdated, then completely uninstall the Salesforce CLI and follow the previous instructions to reinstall.
To develop a Function using TypeScript or Java, you need the Salesforce SDK.
When you generate a function with
sf generate function, these dependencies appear in the example code.
See Salesforce SDK for Node.js Functions for more on using Node.js.
See Salesforce SDK for Java Functions for more on using Java.
If you use Visual Studio Code, install Salesforce Extensions for Visual Studio Code, which includes support for working with Salesforce Functions using the Command Palette.
To install, browse for the extension within Visual Studio Code, or go to Salesforce Extensions for Visual Studio Code and click Install the Salesforce Extensions.