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

Install and Update Salesforce CLI 

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.

    1sf update

    Run the update command even if you previously installed Salesforce CLI. Check the Salesforce CLI Release Notes for the most recent CLI versions.

    Note

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

    1sf --version

    Example output:

    1@salesforce/cli/2.23.20 darwin-x64 node-v20.10.0

    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.

    1sf plugins install functions
  5. Run sf plugins --core and view the list of all installed plug-ins. Make sure the Salesforce Functions plugin is installed.

    1sf plugins --core

    The output looks like this:

    1sf plugins --core
    2@oclif/plugin-autocomplete 3.0.4 (core)
    3@oclif/plugin-commands 3.1.0 (core)
    4@oclif/plugin-help 6.0.9 (core)
    5@oclif/plugin-not-found 3.0.7 (core)
    6@oclif/plugin-plugins 4.1.14 (core)
    7@oclif/plugin-search 1.0.10 (core)
    8@oclif/plugin-update 4.1.7 (core)
    9@oclif/plugin-version 2.0.11 (core)
    10@oclif/plugin-warn-if-update-available 3.0.8 (core)
    11@oclif/plugin-which 3.0.14 (core)
    12@salesforce/cli 2.23.20 (core)
    13apex 3.0.14 (core)
    14auth 3.1.0 (core)
    15command-reference 3.0.61
    16data 3.0.13 (core)
    17deploy-retrieve 2.2.12 (core)
    18functions 1.22.11    <================= Functions plugin!
    19info 3.0.13 (core)
    20limits 3.1.0 (core)
    21marketplace 1.0.15 (core)
    22org 3.2.0 (core)
    23packaging 2.0.1 (core)
    24schema 3.1.0 (core)
    25settings 2.0.14 (core)
    26sobject 1.0.7 (core)
    27source 3.0.10 (core)
    28telemetry 3.1.8 (core)
    29templates 56.0.8 (core)
    30trust 3.2.5 (core)
    31user 3.2.0 (core)
    32
    33Uninstalled JIT Plugins:
    34community 3.0.10
    35custom-metadata 3.0.12
    36dev 2.1.3
    37devops-center 1.2.5
    38env 3.0.13
    39signups 2.0.13
    40@salesforce/sfdx-plugin-lwc-test 1.1.1
    41@salesforce/sfdx-scanner 3.19.0

If your versions are still outdated, then completely uninstall the Salesforce CLI and follow the previous instructions to reinstall.

Tip

Use the Salesforce SDK for Functions 

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.

Note

See Salesforce SDK for Node.js Functions for more on using Node.js.

See Salesforce SDK for Java Functions for more on using Java.

Install Salesforce Extensions for Visual Studio Code 

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.

Product Retirement Announcement

Salesforce Functions is no longer available for purchase or renewal. To preserve the capabilities that Salesforce Functions provided to your org, deploy an alternative solution before your existing order term ends. See Salesforce Functions Retirement for more information on migrating your functions. Contact your Salesforce Account Executive for more information on Heroku.