Set Up Your Development Environment

To develop and run Salesforce Functions, install development tools. The tools vary depending on the language you use.

Prerequisites

To work with Salesforce Functions, install these tools:

  • Node.js 14 or higher to develop Functions that use JavaScript or TypeScript. Use npm version 6.13.4 or higher.
  • OpenJDK 8 or higher and Apache Maven 3.6.3 or higher to develop Functions that use Java.
  • Docker Desktop to build and run Functions locally.
  • 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.

Install and Update Salesforce CLI

Salesforce CLI is a bundle of two executables: sf and sfdx.

The 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.

The 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.

  1. To get both executables, install Salesforce CLI.

  2. Update to the latest version.

    Run this command even if you previously installed Salesforce CLI.

  3. Confirm you have Salesforce CLI version 7.121 or later.

    The output looks like this:

  4. Now switch to the sf executable to view a list of all its plug-ins, including the functions plug-in.

    The output looks like this:

Install the Salesforce SDK for Node.js Functions

To develop a Function using TypeScript, install the Salesforce SDK for Node.js Functions.

See Salesforce SDK for Node.js Functions.

Install the Salesforce SDK for Java Functions

If the Maven pom.xml file includes the SDK as a dependency, the SDK installs during builds.

To install the SDK manually, download the jar file from Maven central.

See Salesforce SDK for Java Functions.

Install Salesforce Extensions for Visual Studio Code

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.