• This repository has been archived on 02/Oct/2023
  • Stars
    star
    204
  • Rank 192,063 (Top 4 %)
  • Language
    JavaScript
  • License
    Creative Commons ...
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Functions Recipes is a library of examples to help you getting started with Salesforce Functions and get used to their main features.

Functions Recipes

CI Workflow codecov lerna

Functions Icon

Introduction

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.

Getting Started

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.

Prerequisites

Please refer to the Install Prerequisites for detailed information about the necessary tools to start developing Salesforce Functions.

Salesforce Org Setup and Deployment

For more information about how to configure your organization for Salesforce Functions, please refer to the documentation

Prerequisite: Functions Enabled Org

  1. If you haven't already done so, authorize with your org and provide it with an alias (fnrecipesorg in the command below):

    sf login org -d -v -a fnrecipesorg
  2. Clone the functions-recipes repository:

    git clone https://github.com/trailheadapps/functions-recipes
    cd functions-recipes
  3. Create a scratch org and provide it with an alias (functions_recipes in the command below):

    sf env create scratch -f config/project-scratch-def.json -a functions_recipes -d

Salesforce Functions Deployment

For more information about how to deploy Functions to a Compute Environment and connect it to an org, please refer to to the documentation

  1. Login to your Salesforce Functions account:

    sf login functions
  2. Create a Compute Environment to deploy the functions and connected it to your org:

    sf env create compute --connected-org=functions_recipes --alias=recipes_env
  3. Deploy the functions

    sf deploy functions --connected-org=functions_recipes
  4. Push source app to the scratch org:

    sf deploy metadata --ignore-conflicts
  5. Assign the FunctionsRecipes and Functions permission sets to the default user:

    sf org assign permset -n FunctionsRecipes,Functions
  6. Open the Functions Recipes App

    sf env open -p "/lightning/n/Functions"
  7. Activate the Functions Recipes Theme (Optional)

    sf env open -p "/lightning/setup/ThemingAndBranding/home"

Functions Recipes App

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.

Screenshot

Local Development

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.

For Local Development you can use any DevHub enabled org, just make sure to create the scratch org without the Functions feature enabled and avoid the Salesforce Functions Deployment steps.

Available Recipes

  1. Introduction to Functions
  2. InvocationEvent
  3. Context
  4. Logging
  5. Environment Variables
  6. Heroku Data

More Repositories

1

lwc-recipes

A collection of easy-to-digest code examples for Lightning Web Components on Salesforce Platform
JavaScript
2,544
star
2

apex-recipes

A library of concise, meaningful examples of Apex code for common use cases following best practices.
Apex
927
star
3

ebikes-lwc

Sample application for Lightning Web Components and Experience Cloud on Salesforce Platform. Retail use case. Get inspired and learn best practices.
JavaScript
774
star
4

dreamhouse-lwc

Sample application for Lightning Web Components on Salesforce Platform. Part of the sample gallery. Real estate use case. Get inspired and learn best practices.
JavaScript
391
star
5

automation-components

Automation Components are a collection of reusable and production-ready extensions that include invocable actions, flow screen components and local actions.
Apex
359
star
6

lwc-recipes-oss

A collection of easy-to-digest code examples for Lightning Web Components on any platform.
JavaScript
322
star
7

easy-spaces-lwc

Sample application for Lightning Web Components on Salesforce Platform. Part of the sample gallery. Event management use case. Get inspired and learn best practices.
JavaScript
225
star
8

dreamhouse-sfdx

Salesforce Sample App part of the sample gallery. Real estate use case. Get inspired and learn best practices.
Apex
195
star
9

ecars

Sample application for Lightning Web Components and Salesforce Platform runtime and compute capabilities. Part of the sample gallery. Electric car manufacturer use case. Get inspired and learn best practices.
JavaScript
181
star
10

visualforce-to-lwc

A collection of code examples to help you move from Visualforce to LWC.
JavaScript
124
star
11

az-insurance

Sample app that demonstrates how to build customer/partner/marketing experiences for Salesforce Experience Cloud and Lightning Web Runtime.
HTML
111
star
12

purealoe

Salesforce Sample App part of the sample gallery. Agriculture and retail use case. Get inspired and learn best practices.
Apex
71
star
13

easy-spaces

Salesforce Sample App part of the sample gallery. Event Management use case. Get inspired and learn best practices.
JavaScript
61
star
14

dreaminvest-lwc

Sample application for Lightning Web Components on Salesforce Platform. Part of the sample gallery. Financial services use case. Get inspired and learn best practices.
CSS
45
star
15

ready-to-fly

Sample app that shows how to integrate Salesforce with Slack.
JavaScript
43
star
16

redwoods-insurance

Sample car insurance app. Redwoods Insurance is a fictitious car insurance company. This application, which consists of a Salesforce Lightning Console app and a mobile application for iOS, helps agents and customers with insurance claims.
Swift
42
star
17

build-apps-with-lwc

Ursus Park sample app for Trailhead project Build Flexible Apps with Lightning Web Components
Apex
35
star
18

dreaminvest

Salesforce Sample App part of the sample gallery. Financial services use case. Get inspired and learn best practices.
CSS
24
star
19

ebikes-manufacturing

E-Bikes Manufacturing site built with LWR
JavaScript
20
star
20

github-action-sfdx-packaging-updater

Github Action that removes legacy package versions from sfdx-project.json
JavaScript
16
star
21

einstein-twitter-analyzer

JavaScript
15
star
22

ebikes-communities-lwc

Sample application for Lightning Web Components and Communities. Part of the sample gallery. Retail use case. Get inspired and learn best practices.
JavaScript
10
star
23

purealoe-lwc

Sample application for Lightning Web Components on Salesforce Platform. Part of the sample gallery. Agriculture and retail use case. Get inspired and learn best practices.
Apex
3
star
24

redwoods-project

Start project for the Develop a car Insurance App with Swift and the Salesforce Mobile SDK for iOS trailhead project
Swift
1
star