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:

  • Node.js 20 or higher to develop functions that use JavaScript or TypeScript. Use npm version 10.1.0 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 your 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 command-line interface that simplifies development and build automation when working with your Salesforce org and Salesforce Functions.

  1. Install Salesforce CLI.

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

  3. Confirm you're using Salesforce CLI sf(v2).

    Example output:

    If your output looks like sfdx-cli/7.176.1 darwin-x64 node-v18.12.0, then you're using a deprecated Salesforce CLI version (sfdx v(7)) and you must update to sf (v2). See Move from sfdx (v7) to sf (v2).

  4. Install the Salesforce Functions plugin.

  5. Run sf plugins --core and view the list of all installed plug-ins. Make sure the Salesforce 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.

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.