Skip to main content

Set Up the BOTanicals App

Learning Objectives

In this project, you'll:

  • Install a package in your Trailhead Playground.
  • Create an Apex class and method.
  • Create a trigger.
  • Automate the process of creating a new sObject.

Introduction to BOTanicals

Bouquet of colorful flowers with the BOTanicals logo.

BOTanicals is a company that makes robotic flowers, the environmental and hypoallergenic alternative to traditional flowers. These flowers change color to suit your mood, glow in the dark, and never die. They're controlled by a state-of-the-art Salesforce org that's connected to the Internet of Things. You're just in time for the BOTanical Bonus Bouquet promotion. In this project, we automate a business process to support the promotion. Specifically, we code our app to add a bonus bouquet every time an order is activated.

Order form labeled Active = +1 Bonus Bouquet.

Note

In this project, we work with business processes that you could easily automate using point-and-click admin tools. As you work through the steps, think about the connection between what is happening in the code and how you would do the same tasks in the Salesforce UI.

The BOTanical Object Model

First things first, let's look at our object model.

Diagram of the object model corresponding to the table that follows

Account

Order

OrderItem

Product

ID

Account Name (ID)

Order (ID)

Order Product Number (ID)

Product (ID)

Fields

Account Name

Order

Product

numberOfFlowers__c

percentOfOpening__c

fragrance__c

grow__c

colorTheme__c

numberOfFlowers__c

percentOfOpening__c

Object Relationships

Account Name (ID) maps to the Account Name field on the Order object

Order (ID) maps to the Order field on the OrderItem object

Product (ID) maps to the Product field on the OrderItem object

You probably notice a few familiar standard objects: Account, Order, OrderItem, and Product. There are also some custom fields in the OrderItem and Product objects. Each Order belongs to a single Account. Each OrderItem belongs to a single Order and a single Product.

Most of our coding revolves around the Order and OrderItem standard objects.

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

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.

Launch Your Trailhead Playground and Install a Package

Let's get started by opening your Trailhead Playground and installing a package. First, scroll to the bottom of this page and click Launch If you see a tab in your org labeled Install a Package, great! Follow the steps below.

If not, from the App Launcher (), find and open Playground Starter and follow the steps.

  1. Click the Install a Package tab.
  2. Paste 04t8b000001RwQK into the field.
  3. Click Install.
  4. Select Install for Admins Only, then click Install.

When the package is finished installing, you see a confirmation page and get an email to the address associated with your playground.

Update the Default Order Page Layout

  1. Click Setup and select Setup.
  2. Click Object Manager.
  3. Click Order.
  4. Click Page Layouts.
  5. Click Page Layout Assignment.
  6. Click Edit Assignment.
  7. Click the Page Layout column header to select all the profiles.
  8. For Page Layout to Use, select Order Layout (BOTanicals).
  9. Verify the Page Layout column now lists Order Layout(BOTanicals) for every profile. Page Layout Assignments for each profile listing the Order Layout (BOTanicals) option.
  10. Click Save.

Pin Three List Views in the BOTanicals App

  1. From the App Launcher (), find and open BOTanicals. The list views on the BOTanicals home page will be empty. Don't worry, we add some data soon.
  2. Click All Accounts (BOTanicals).
  3. Click Pin this list view to pin the list view on this page.
  4. Click Home.
  5. Pin the All Orders (BOTanicals) list view and the All Products (BOTanicals) list view.

Load Sample Data

  1. Click Setupand select Setup.
  2. In the Quick Find box, enter Flows.
  3. Under Process Automation, select Flows.
  4. Click Load Sample Data.
  5. Click Run.
  6. When you see YOUR FLOW FINISHED, close the Load Sample window.
  7. Close the Flow Builder window.
  8. From the App Launcher (), find and open BOTanicals.

Your home page should now have entries in the Accounts, Orders, and Products sections. The BOTanicals app is ready to go.

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈