Salesforce Functions lets you use the Salesforce Platform for building event-driven, elastically scalable apps and experiences. Salesforce Functions is designed to boost developer productivity by reducing your infrastructure responsibilities and enabling you to build and integrate Functions-as-a-Service (FaaS) apps using the languages and tools of your choice.
Functions Recipes is a library of examples to help you getting started with Salesforce Functions and get used to their main features.
To learn more about Salesforce Functions please visit the documentation center.
You can use Functions both locally and deployed to a Salesforce Organization, if you don't have access to a Functions Enabled Org, you can still use the examples in this repository, please refer to the Local Development section for more information.
Please refer to the Install Prerequisites for detailed information about the necessary tools to start developing Salesforce Functions.
For more information about how to configure your organization for Salesforce Functions, please refer to the documentation
Prerequisite: Functions Enabled Org
sfdx auth:web:login -d -a fnrecipesorg
git clone https://github.com/trailheadapps/functions-recipes cd functions-recipes
sfdx force:org:create -s -f config/project-scratch-def.json -a functions_recipes
For more information about how to deploy Functions to a Compute Environment and connect it to an org, please refer to to the documentation
sf login functions
sf env create compute --connected-org=functions_recipes --alias=recipes_env
sf deploy functions --connected-org=functions_recipes
sfdx force:source:push -f
sfdx force:user:permset:assign -n FunctionsRecipes
sfdx force:user:permset:assign -n Functions
sfdx force:org:open -p "/lightning/n/Functions"
sfdx force:org:open -p "/lightning/setup/ThemingAndBranding/home"
After deploying both the Salesforce app and the functions, you can open the Salesforce org and navigate to the Functions Recipes application:
From there you'll be able to explore the source code and invoke the deployed functions.
Each individual function can be started and invoked locally using the Salesforce CLI, you can refer to each individual README for instructions on how to start and invoke each function locally.