進行状況の追跡を始めよう
Trailhead のホーム
Trailhead のホーム

Prepare Your Org and Install Developer Tools

Learning Objectives

After completing this unit, you’ll be able to: 

  • Set up your workspace for Salesforce development.
  • Install the unmanaged package for this module.

A Map of Your Adventure

Your adventures working with metadata have likely been full of twists and turns. So far, you’ve probably only migrated metadata using change sets, or maybe with unlocked packages using Salesforce CLI. For this hands-on challenge, you learn how to pull and migrate metadata with an XML manifest file, and use the Salesforce CLI commands to make it happen. First, set up your workspace.

Install and Update Visual Studio Code

Before you can write any code, you need to install a code editing tool. Visual Studio Code is a powerful editor that is highly customizable and cross-platform. Salesforce Extensions for Visual Studio Code is the successor to the Force.com IDE plug-in for Salesforce development on the desktop. Let’s install Visual Studio Code (VS Code) and set up the extension.

  1. Install Visual Studio Code from https://code.visualstudio.com/Download.
  2. Open the Visual Studio Code application.

Install Visual Studio Salesforce Extension

The Salesforce extensions provide features such as code completion, syntax highlighting, Apex debugging, and more for the Lightning Platform.

  1. In Visual Studio Code, click the View menu then choose Extensions.
  2. Enter salesforce extension pack in the search box.
  3. Click Install (or Update) for the Salesforce Extension Pack result.
    Installing Salesforce Extension Pack for Visual Studio Code.
  4. Once installed, relaunch Visual Studio Code to ensure the changes take effect.

You now have a powerful tool that enables you to do some pretty cool development projects. From here on, you use VS Code for all terminal commands and code editing. 

Install and Update Salesforce CLI

Time to get another new tool to complement your new editor. For this hands-on challenge, you install (or upgrade, if you already have it installed) the Salesforce CLI. You can use CLI commands to easily create scratch orgs for developing and testing customizations, and synchronize source code between orgs and source repositories.  

  1. Install Salesforce CLI from https://developer.salesforce.com/tools/sfdxcli.
  2. To confirm and upgrade Salesforce CLI is properly installed, Open VS Code and in the top navigation menu, select Terminal.
  3. Click New Terminal.
  4. Paste in the following command and run it by pressing Enter.
    sfdx version
    1. If an update is needed, run the following command to update the CLI.
      sfdx update
    2. If an update is taking place, there will be an output in the terminal window like this:
      Salesforce CLI version updates in terminal window.
  5. Once you have installed or updated the Salesforce CLI, the output in the terminal window will look like this:
    Salesforce CLI update command result in terminal window.

Authorize Your Dev Hub

Now is a good time to double check that Dev Hub is enabled in your Trailhead playground. 

  1. Scroll to the bottom of this page, select the Trailhead Playground you’ll use to complete the hands-on challenge in this unit from the hands-on org dropdown, and click Launch.
  2. In your playground, click the Setup icon Setup and select Setup.
  3. From Setup, enter Dev Hub in the Quick Find box and select Dev Hub.
  4. Click Enable Dev Hub. Also select Enable Unlocked Packages and Second-Generation Managed Packages.

To authorize your playground, you need your username and password.

  1. In your playground, click Setup  and select Setup.
  2. Enter Users in the Quick Find box, then select Users.
  3. Check the box next to your name. Take note of your username.
  4. Click Reset Password(s) and then OK. This step sends an email to the address associated with your username. If you don’t see the email, check your spam folder.
  5. Click the link in the email.
  6. Enter a new password and confirm it.

Now you’re ready to authorize your playground. 

  1. In the VS Code app, click Terminal in the top navigation menu and select New Terminal.
  2. Log in to your playground and authorize the Salesforce CLI. This command also gives your org the alias DevHub.
    sfdx force:auth:web:login -d -a DevHub
  3. When the Salesforce login page opens in your browser, enter the username and password you just got and click Log In.
  4. Click Allow to authorize the Salesforce CLI.

Once you’ve logged in, you see a success message in the terminal window.

Install the Unmanaged Package 

When migrating or creating new features to an app, the metadata is already in an org. So we’ve created some sample metadata for you to use in this module. Think of it as a drop-shipment of goods in the form of an unmanaged package. Let’s go ahead and install the package. 

Note

Note

To make sure you install the package in the correct org, log out of any existing orgs.

  1. Launch your Trailhead Playground by scrolling to the bottom of this page and clicking Launch.
  2. If you see a tab in your org labeled "Install a Package", great. Follow the steps below.
    1. Click the Install a Package tab.
    2. Paste 04t3i000002SXKQ into the field.
    3. Click Install.
    4. Select Install for Admins Only, then click Install.
  3. If you don’t see the Playground Starter app, copy https://login.salesforce.com/packaging/installPackage.apexp?p0=04t3i000002SXKQ and check out Install a Package or App to Complete a Trailhead Challenge on Trailhead Help.
  4. When your package is finished installing, you see a confirmation page and get an email to the address associated with your playground.

You will be redirected to your org, where you can see what was installed as part of the package.

  1. Once you’ve installed the package, from the Setup menu, enter Object in the Quick Find box, and select Object Manager.
  2. Click the custom object Sticker to see the details of the custom object installed with the package.
  3. Enter Tab in the Quick Find box, and select Tabs.
  4. Under the Custom Objects section, select Stickers. This is the new custom tab from the installed package.

Great job! Now that you have all your gear, let’s get to your next adventure, writing your first XML file and migrating metadata.

Resources