Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Deploy the Apex Recipes Sample App

Learning Objectives

In this project, you’ll:

  • Deploy the Apex Recipes sample app.
  • Learn about the app use cases.
  • Explore the Apex Recipes sample app implementation.

Introducing the Apex Recipes Sample App

In this project you deploy and explore the Apex Recipes sample app. Apex Recipes is an opinionated set of examples demonstrating the correct way to do X, Y, or Z in Apex. You’ll find recipes demonstrating everything from safely querying data to how to write sustainable triggers. These examples are designed to be as concise as possible, while still reflecting real-world scenarios. It is our hope that developers will find these recipes an accessible starting point for their own solutions.

Apex Recipes is broken into a number of folders. Each folder contains code related to a particular solution, or set of solutions. For instance, the Trigger Recipes folder contains—you guessed it!—code related to properly writing triggers. When you explore the source code for Apex Recipes, you’ll find these folders.

  • Async Apex Recipes
  • Data Recipes
  • Integration Recipes
  • Invocable Recipes
  • Platform Event Recipes
  • Security Recipes
  • Shared Code
  • Trigger Recipes

Additionally, you’ll find the corresponding unit tests in the force-app/tests folder which are sorted into the same folder structure. 

View of the folder structure of Apex Recipes in Visual Studio Code.

About This Project

In this Quick Start project, you install a sample app from the Trailhead Sample Gallery. The sample app has examples that you can use to learn about writing sustainable Apex code. It also has code illustrating intelligent abstractions that help you write reusable code. 

If you’d like to tour the sample app gallery, see Quick Start: Explore the Sample App Gallery

Before You Start

Before you take the steps in this hands-on project, make sure you complete Quick Start: Salesforce DX project. That badge walks you through setting up and working in your Salesforce DX development environment.

Note

Note

For this Quick Start, you need a set of tools we call Salesforce DX (Developer Experience). It includes the Salesforce Command Line Interface (CLI) and Visual Studio Code, which, with the Salesforce Extension Pack, is the recommended code editor for developing on the Salesforce Platform.

To clone the repository that contains the sample app, you use Git, a version control system. Follow the instructions in this step to install Git. Then follow the instructions in the sample app readme file to clone the sample app repository and deploy the sample app to your Trailhead Playground.

Create a New Trailhead Playground

For this project, you need to create a new Trailhead Playground. Scroll to the bottom of this page, click the down arrow next to Launch, and select Create a Trailhead Playground. It typically takes 3–4 minutes to create a new Trailhead Playground. 

Note

Note

Yes, we really mean a brand-new Trailhead playground! If you use an existing org or playground, you can run into problems completing the challenges.

Get Your Trailhead Playground Username and Password

Let's get started. Go to your Trailhead Playground. (If it’s not already open, scroll to the bottom of this page and click Launch.) If you see a tab in your org labeled Get Your Login Credentials, great! Skip ahead to step 1. 

Otherwise, from the App Launcher (App Launcher), find and open Playground Starter and follow the steps. If you don’t see the Playground Starter app, check out Find the Username and Password for Your Trailhead Playground on Trailhead Help.

  1. Click the Get Your Login Credentials tab and take note of your username.
  2. Click Reset My Password. This sends an email to the address associated with your username.
  3. Click the link in the email.
  4. Enter a new password, confirm it, and click Change Password.

Get Git Command Line

  1. Install Git from https://git-scm.com/downloads. Accept all of the default installation settings.
  2. Confirm that Git is installed. In Terminal (macOS) or Command Prompt (Windows), enter this command:
    git
    The output should be a list of git commands.

Deploy the App

Now that you have all of the tools installed and integrated, you use Visual Studio Code to deploy the Apex Recipes sample app in your Trailhead Playground.

  1. Open Visual Studio Code.
  2. Open the Command Palette: Click View | Command Palette.
    Alternatively, press Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
  3. Open a terminal window: Click Terminal | New Terminal.
    This is where you enter or paste the commands provided in the following instructions.
  4. Deploy the app to your Trailhead Playground org by following the instructions from the project readme in the section Installing the App using a Developer Edition Org or a Trailhead Playground via the Salesforce CLI.

Congratulations! You’ve successfully set up the Apex Recipes sample app. In the next step, you explore the app.

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기