Salesforce Functions Overview and Architecture

Salesforce Functions lets you extend Salesforce business logic to meet any demand. With Functions, you write code in industry-standard programming languages, and run your code within the Salesforce trust boundary. When your code runs, it automatically scales with load and doesn’t count against your Salesforce request limits.

Salesforce Functions has its own limits. See Understand Functions Limits for more information.

Salesforce Functions lets you use industry-standard programming languages and frameworks. Your team now can use their preferred language and tools to develop Salesforce solutions, instead of having to write or rewrite code in a Salesforce-specific language. Your Salesforce app can now use open-source or third-party frameworks, saving you development time and effort.

Salesforce Functions securely and seamlessly works with your existing org resources, making it easy to stay on the Salesforce Platform. Salesforce Functions automatically authenticates to the org invoking your function at run-time so you don’t have to worry about dealing with authentication or any other complexities involved in making an external system access your org.

With Salesforce Functions, you can perform compute-heavy tasks that would be difficult or impossible to do in your org. Salesforce elastically scales compute resources for your functions for you, meaning you don’t have to manually modify compute resource configurations every time you update your function.

Salesforce Functions are deployed to, and run in, a secure Salesforce-managed infrastructure separate from your Salesforce org. Your functions are developed and tested in their own testing and production "spaces" that are isolated from the rest of your production environment. The application lifecycle of development, integration, and testing of a function takes place in these spaces, shielding the production org from any impact or interference.

A function is code that performs a specific compute task. You could have a function that reads your sales data and calculates a sales tax, or a function that collects data and generates a formatted PDF report file. Functions can securely work with org data, but aren’t deployed to your org or run in your org’s infrastructure.

Functions are contained in the functions directory of a Salesforce DX project. One or more functions can be included in a single project. For example, you have a “Billing” project that contains a “CalculateTax” function and a “GeneratePDF” function. Projects are created using Salesforce DX. Create a DX project that contains your function code, function configuration files, Apex code, permissions sets, and anything else necessary for deploying and using the function. Give the project a name (via a parameter in the DX project configuration file) which helps identify a project when deployed.

Salesforce Functions projects are deployed to a Salesforce compute environment. In general, an environment in the Salesforce cloud represents a place where things run. Your org is an environment that runs things like Apex code or Salesforce Flows. A compute environment is where Salesforce Functions code runs. A single compute environment contains a single function, so that your functions in a project can run in an isolated and dedicated environment.

Your Salesforce org can be connected to one or more compute environments. When you deploy your Salesforce DX project that contains functions, specify an org that will invoke the project's functions. The Salesforce Functions deploy process uses your org information and the project name to determine which compute environment to use or create. For example, if you wanted to test your “Billing” project in a sandbox org, deploy your project, specifying your sandbox org, and the deploy process will determine the compute environment to use and automatically connect your org to this compute environment.

When invoking a function from your org, specify the project name and the function name. Because your org is already connected to a compute environment, the invocation process knows exactly which compute environment to use. You don’t have to specify the compute environment, which ensures that you can’t, for example, accidentally run your in-development function in a compute environment connected to your production org.

The infrastructure for Salesforce Functions compute environments is available in the following regions:

  • Virginia, USA
  • Oregon, USA
  • Dublin, Ireland
  • Frankfurt, Germany
  • Tokyo, Japan
  • Sydney, Australia

Contact your account executive to choose or change regions for your compute environments.

Hyperforce orgs are interoperable.

A Salesforce Functions license is required to enable Salesforce Functions for your org. Contact your Salesforce account representative for steps to acquire the license.