---
schema_version: "1"
id: 093374e63b52c6f320ad97ac74eb28fe1b460f3a482305b467216a7ed81a788b
title: Explore Solutions and Sample Code
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforce-functions/functions/guide/solutions_and_samples.md
canonical_url: https://developer.salesforce.com/docs/platform/functions/guide/solutions_and_samples.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b84b138670715788e7c17b32aa7bdcbae1fde77df7dd63f941c8f05cf16c8bc9
products:
  - Salesforce Functions
---
# Explore Solutions and Sample Code

Get help using Salesforce Functions to solve specific problems.

Our library of solutions covers all aspects of creating and working with Salesforce Functions. Many solutions include links to sample code that you can use as a starting point for your function development.

## Visit Sample Code Repositories

Check out these GitHub repositories, which contain Salesforce Functions recipes.

- [**Functions Recipes**](https://github.com/trailheadapps/functions-recipes)
- [**eCars Sample**](https://github.com/trailheadapps/ecars/)
- [**Salesforce PDF Generator**](https://github.com/developerforce/pdf-generator)
- [**Accounts Sync App**](https://github.com/developerforce/account-merge)
- [**PostgreSQL for Node.js**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/06_Data_Postgres_JS)
- [**PostgreSQL for Java**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/06_Data_Postgres_Java)
- [**Redis for Node.js**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/06_Data_Redis_JS)
- [**Redis for Java**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/06_Data_Redis_Java)

## Access Org Data from a Function

Use the Salesforce SDKs, along with other standard Salesforce APIs, to access org resources.

- [**Developer Guide: Access Salesforce Resources**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/develop.md#access-salesforce-resources) Best practices around accessing Salesforce resources.
- [**Reference: Salesforce SDK for Node.js Functions**](https://developer.salesforce.com/docs/platform/functions/guide/nodesdk/NODE_README.md) Reference documentation for the classes and methods of the SDK used to develop TypeScript functions.
- [**Reference: Salesforce SDK for Java Functions**](https://developer.salesforce.com/docs/platform/functions/guide/javasdk/JAVA_README.md) Reference documentation for the classes and methods of the SDK used to develop Java functions.
- [**Sample: SalesforceSDK_JS**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/03_Context_SalesforceSDK_JS) A JavaScript sample function that uses the SDK to insert and query records.
- [**Sample: SalesforceSDK_Java**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/03_Context_SalesforceSDK_Java) A Java sample function that uses the SDK to insert and query records.

## Manage Transactions in a Function

Functions, unlike Apex, don't automatically handle data transactions for you. Transactions ensure that all related data changes are made at the same time and that they can be undone if necessary. To manage transactions in a function, use the `UnitOfWork` SDK class.

- [**Developer Guide: Access Salesforce Resources**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/develop.md#access-salesforce-resources) Best practices around accessing Salesforce resources using `UnitOfWork`.
- [**Developer Guide: Apex Patterns**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/patterns-and-practices.md#patterns-for-apex-developers) If you're used to how transactions work in Apex, see this document for how to transition to creating your own transactions with the SDK.
- [**Reference: Node.js SDK UnitOfWork class**](https://developer.salesforce.com/docs/platform/functions/guide/nodesdk/interfaces/unitofwork.md) Reference documentation on the Node.js SDK `UnitOfWork` class.
- [**Reference: Java SDK UnitOfWork class**](https://developer.salesforce.com/docs/platform/functions/guide/javasdk/interfaces/java-unitofwork.md) Reference documentation on the Java SDK `UnitOfWork` class.
- [**Sample: UnitOfWork_JS**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/03_Context_UnitOfWork_JS) A JavaScript sample function that shows how to use `UnitOfWork` to define your own transactions.
- [**Sample: UnitOfWork_Java**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/03_Context_UnitOfWork_Java) A Java sample function that shows how to use `UnitOfWork` to define your own transactions.

## Develop JavaScript and TypeScript Functions

Use JavaScript or TypeScript along with your favorite Node frameworks to build a function that your org can invoke.

- [**Set Up Your Development Environment**](https://developer.salesforce.com/docs/platform/functions/guide/set-up.md) Set up your dev environment to develop JavaScript functions.
- [**Developer Guide: Develop a Function**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/develop.md) Details about creating JavaScript functions, adding dependencies, specifying a function entry point, and more.
- [**Developer Guide: JavaScript Functions**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/javascript-functions.md) JavaScript-specific information for developing functions – debugging, testing, logging and more.
- [**Reference: Salesforce SDK for Node.js Functions**](https://developer.salesforce.com/docs/platform/functions/guide/nodesdk/NODE_README.md) Reference documentation for the SDK you use to develop JavaScript and TypeScript functions.
- [**Sample: JavaScript samples**](https://github.com/trailheadapps/functions-recipes/tree/main/functions) Sample JavaScript functions (in directories ending with "\_JS").

## Develop Java Functions

Use Java and your favorite Java frameworks to build a function that your org can invoke.

- [**Set Up Your Dev Environment**](https://developer.salesforce.com/docs/platform/functions/guide/set-up.md) Set up your dev environment to develop Java functions.
- [**Developer Guide: Develop a Function**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/develop.md) Detailed information about creating Java functions, adding dependencies, specifying the function entry point, and more.
- [**Developer Guide: Java Functions**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/java-functions.md) Java-specific information for developing functions – debugging, testing, logging, and more.
- [**Reference: Java SDK**](https://developer.salesforce.com/docs/platform/functions/guide/javasdk/JAVA_README.md) Reference documentation for the Salesforce SDK for Java functions.
- [**Sample: Java samples**](https://github.com/trailheadapps/functions-recipes/tree/main/functions) Sample Java functions (in directories ending with `\_Java`).

## Migrate Apex Code to Functions

Do you have Apex code that is hitting Apex compute limits? Transition your Apex code to a function using patterns and best practices, and take advantage of elastic auto-scaling in Salesforce Functions compute environments.

- [**Developer Guide: Functions Patterns for Apex Developers**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/patterns-and-practices.md#patterns-for-apex-developers) Development patterns and best practices for Apex developers developing functions.
- [**Developer Guide: Limits**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/limits.md) Understand how Salesforce Functions limits compare to Apex limits.
- [**Developer Guide: Permissions**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/permissions.md) Understand how Salesforce Functions object permissions compare to Apex permissions.

## Run and Debug Functions Locally

Before you deploy your function, you can run and debug it locally.

- [**Developer Guide: Local Invocation**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/invoke-local.md) Steps for starting your function locally, and invoking it.
- [**Developer Guide: Use Logs to Debug**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/test-and-validate.md#use-logs-to-debug) Debug your function via logs.

## Test Functions

Learn how to integrate your function code and function invocation code in your testing pipeline.

- [**Developer Guide: Test and Validate Functions**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/test-and-validate.md) Best practices for testing functions.
- [**Developer Guide: Development and Application Lifecycle Workflow**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/dev-alm-workflow.md) Details about automating function testing.
- [**Sample: UnitOfWork_JS**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/03_Context_UnitOfWork_JS) A JavaScript sample that shows how to use, mock, and test `UnitOfWork`.
- [**Sample: UnitOfWork_Java**](https://github.com/trailheadapps/functions-recipes/tree/main/functions/03_Context_UnitOfWork_Java) A Java sample that shows how to use, mock, and test `UnitOfWork`.

## Understand Functions and Application Lifecycle Management

Like any Salesforce org custom development, you need to manage how and where functions are tested and deployed. Functions compute environments are tied to orgs, helping you avoid deploying an in-development function to a production org.

- [**Developer Guide: Development and Application Lifecycle Workflow**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/dev-alm-workflow.md) Details about automating function testing.

## Deploy Functions to a Compute Environment

Before a Function can be invoked from a Salesforce org, it must be deployed to a Salesforce Functions compute environment associated with the org.

- [**Overview**](https://developer.salesforce.com/docs/platform/functions/guide/overview.md) Understanding Salesforce Functions projects and compute environments.
- [**Developer Guide: Deploy a Function**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/deploy.md) Steps for connecting an org with Salesforce Functions, creating compute environments, and deploying function projects to compute environments.

## Invoke Functions from Your Org

Salesforce makes it easy to invoke a deployed function from your org, using Salesforce features you're already familiar with, like Apex. You can invoke a function from your org synchronously or asynchronously as easily as calling an Apex method.

- [**Developer Guide: Deploy Function Invocation Using Apex**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/invoke-apex.md) Steps for invoking your deployed function from Apex, synchronously and asynchronously.
- [**Apex Reference Guide: Functions namespace**](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_functions.htm) Reference documentation for the `Functions` Apex namespace used to invoke functions from Apex synchronously or asynchronously. Includes examples of mocking a function invocation.

## Configure Permission Sets for Functions

When invoked, functions use specific permission sets for data access. Understand what permissions you can set, which permission sets to use, and what user role runs the functions.

- [**Developer Guide: Function Permissions**](https://developer.salesforce.com/docs/platform/functions/guide/dev-guide/permissions.md) Details on the Functions permission sets.
