trailhead

Before You Start

Lightning bolt icon used to indicate that the content is for Lightning Experience

Attention, Trailblazer!

Salesforce has two different desktop user interfaces: Lightning Experience and Salesforce Classic. This module is designed for Lightning Experience.

You can learn about switching between interfaces, enabling Lightning Experience, and more in the Lightning Experience Basics module here on Trailhead.

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

Do not attempt to turn on My Domain, or change its settings, in your Trailhead Playground. By default, My Domain is already active in every Trailhead Playground.

My Domain name highlighted in a Trailhead Playground URL

In your production org, My Domain lets you create a subdomain unique to your organization. With My Domain, you replace the instance URL that Salesforce assigns you, such as https://na17.lightning.force.com, with your chosen subdomain, for example, https://mydomainname.lightning.force.com.

My Domain is required to create custom Lightning components and set up single sign-on (SSO) in an org. To learn more about My Domain, check out this knowledge article. To learn how to activate it in your production org, see the User Authentication module.

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. Lightning components 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
    API Name Expense__c
    Accept the defaults for the rest of the object definition.
  4. Add custom fields to the Expense object.
    Scroll 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 Label API Name Field Type
    Amount Amount__c Number(16,2)
    Client Client__c Text(50)
    Date Date__c Date
    Reimbursed Reimbursed__c Checkbox

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!

Resources

Lightning bolt icon used to indicate that the content is for Lightning Experience

Remember, this module is meant for Lightning Experience. When you launch your hands-on org, switch to Lightning Experience to complete this challenge.

retargeting