Before You Start



Since Lightning Web Components is the preferred way to build UI with Salesforce, head over to the Migrate from Aura to Lightning Web Components trail to learn how to use LWC and comply with current web standards. Otherwise, continue with this badge to learn more about Aura.

Learning Objectives

After completing this unit, you’ll be able to:
  • Determine if you have the skills to complete this module.
  • Create a required custom object.
  • Configure your org for Lightning components development.

Before You Start This Module

We know. You’re rarin’ to get started. And far be it from us to dampen anyone’s enthusiasm for Lightning components or Trailhead! But before you settle in to work through this module, we have a few things you should do. We suggest you do them before you plan to start the subsequent units, to avoid errors about missing objects or otherwise wasting your time.

The first thing we’ll do is discuss My Domain. My Domain is required to develop with Lightning components, and it’s also a pretty cool feature you should consider for your production org. We’ll also create a necessary custom object, the Expense object, in your org.

Last, we need to have a chat about whether you want to take this module on. Nobody likes to be excluded, but really, this module isn’t for everyone. So we want to take a moment and talk about who this module is for, and skills you’ll need to complete it.

We know this sounds like we’re harshing on your excitement. We hate that as much as you do. But we want to be respectful of your time. If this isn’t the right module for you, let’s get you pointed at a different part of Trailhead, so your time with us is fun and challenging, without being frustrating.

My Domain Is Already On in Your Trailhead Playground

By default, My Domain is already turned on in every Trailhead Playground. Don’t attempt to turn on My Domain, or change its settings, in your Trailhead Playground. Changing the My Domain settings can lock you out of your playground org.

My Domain name highlighted in a Trailhead Playground URL

In your production org, My Domain lets you create a subdomain unique to your organization. If your org’s login URL contains your Salesforce instance, such as, deploying a My Domain replaces it with your company-specific login URL, such as

My Domain is required to create custom Lightning components and set up single sign-on (SSO) in an org. It’s so important that all production, Developer Edition, and trial orgs created in Winter ’21 org later get a My Domain by default. To learn how to activate My Domain in your production org, see the User Authentication module. To learn more about My Domain and your Trailhead Playground, check out this knowledge article

Define the Expense Custom Object

Many of the examples we’ll use in this module depend on a custom Expense object. You’ll get the most out of this module if you add these samples to your org and experiment with them for yourself. References to sObjects are validated on save and, if any object is undefined, the component is invalid. Salesforce won’t let you save a component it knows is invalid. Let’s create the Expense object up front, so you don’t run into any problems compiling and saving code that depends on it.

While we assume that you know how to create a custom object already, here are brief instructions, and the specifics for the Expense object and its fields.

  1. Go to the Object Manager. From Setup, at the top of the page, click Object Manager.
  2. Create the custom object. Select Create | Custom Object.
  3. Define the Expense object. Enter the following values for the object’s definition.
    Field Value
    Label Expense
    Plural Label Expenses
    Starts with vowel sound checked
    Object Name Expense
    Accept the defaults for the rest of the object definition.
  4. Add custom fields to the Expense object. Go to the Fields & Relationships section of the object details page. For each of the following fields, click New and define the field with the following details.
    Field Type Field Label Field Name Properties (otherwise accept defaults)
    Number Amount Amount Length: 16, Decimal Places: 2
    Text Client Client Length: 50
    Date Date Date
    Checkbox Reimbursed Reimbursed

Skills You Need to Complete This Module

One of the great things about Salesforce is how much you can customize it using the app. Custom objects and fields, formulas, flows, reports, approvals, and even the user interface itself—you can do all of these things and more from Setup, without writing a line of code, and make your users very happy.

But there are some features of Salesforce that require code, and the Lightning Component framework is one of them. There are no two ways about it: to be successful with Lightning components, you need to be able to read and write code. We will look at a lot of code throughout this module, and you have to write a fair bit yourself to pass the challenges.

Specifically, we think that:

  • You should be comfortable reading and writing JavaScript. Although Lightning components also use HTML-style markup, doing anything beyond “hello world” requires JavaScript. There’s an enormous number of resources, free and otherwise, for learning JavaScript. We’d recommend getting started at JavaScript the Right Way. But if your friend or colleague has a recommendation, or a book they can loan you, go for it!
  • It would be great if you know Apex. Reading and writing data from Salesforce usually uses Apex, and that’s what we’ll learn in this module. You can pass the challenges in this module without being an Apex guru, but when you go to write real apps, you’ll be writing plenty of Apex. The Apex Basics & Database module is a great way to get started with Apex, and will give you everything you need for this module.
  • If you’re coming to Lightning components from Visualforce, be sure to add the Apply Visualforce Skills to Lightning Components trail to your task list. Lightning components have a couple of differences that often trip up Visualforce developers. More importantly, it’s several more badges, and all of them together are easier than this one.

If this list doesn’t describe you, we don’t want to turn you away. It’s not impossible to complete this module without the preceding skills. But we do think it will be frustrating. And while you might earn the badge—which is definitely cool!—you won’t really be ready to use Lightning components to write apps.

We want Trailhead to be fun, and we want it to help people use Salesforce more completely and confidently. Experienced programmers will get a lot out of this module. But grinding through it without the requisite programming background might not be the best use of your Trailhead Time.

OK. With that out of the way, let’s dive in and start learning!


Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities