Skip to main content

Prepare Your Org to Access the Models API

Learning Objectives

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

  • Sign up for an AI Playground.
  • Authorize your AI Playground in Visual Studio Code.
  • Create a Salesforce DX Project.

Before You Start

Before you complete the steps in this unit, make sure you complete the badge, Quick Start: Lightning Web Components. ​​The first two steps of that badge walk through setting up your Salesforce DX development environment, which you’ll need for this project.

The Next Step for DreamHouse Realty

After planning her first AI project with DreamHouse Realty, Maria needs to set up her org and environment so that she can begin building her dashboard. The Models API is accessible from any org with Einstein Generative AI and Data Cloud enabled.

Sign Up for a Trial Org with Einstein Generative AI

To complete this project, you need a special, 14-day custom playground that contains Einstein AI and Data Cloud.

  • If you haven't already, click the checkbox: I can receive a password email at the beginning of the unit.
  • Click Create Playground.
  • Follow the prompts.
Note

This custom playground is designed to work with the challenges in this badge and may not work for other badges. Always check that you’re using the AI Playground or special org that we recommend.

Also note that when you create a custom playground, store your username and password somewhere safe. These credentials are required when connecting your Visual Studio Code environment.

If you haven’t already, launch your AI playground.

  1. Click the gear icon (“”) and click Setup. The Setup page opens in a new tab.
  2. In the Quick Find search box, type Einstein Setup.
  3. Click Einstein Setup to open the Einstein Setup page.

Einstein Setup.

  1. Turn on Einstein On/Off Toggle to use generative AI features across your Salesforce Org.

Create a Project

  1. In Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
  2. Type SFDX.
  3. Select SFDX: Create Project.
  4. Press Enter to accept the standard option.
  5. Enter ModelsAPILWC as the project name.
  6. Press Enter.
  7. Select a folder to store the project.
  8. Click Create Project. You should see something like this as your base setup.

The ModelsAPILWC project in VS Code with sub-folders that include .husky and .sfdx

Connect Your Visual Studio Code Environment

Before you can create a Lightning web component, you must connect your AI Playground to your VS Code environment.

Note

Dev Org Required

To access the Models API outside of this module, you need a functional dev environment with Data Cloud and Einstein Generative AI enabled.

Authorize Your AI Playground

In VS Code, authorize your custom Playground.

  1. In Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
  2. Type SFDX.
  3. Select SFDX: Authorize an Org.
  4. Press Enter to accept the Project Default login URL option.
  5. Press Enter to accept the default alias. This opens the Salesforce login in a separate browser window.
  6. Log in using your AI Playground credentials.
  7. If prompted to allow access, click Allow.
  8. After you authenticate in the browser, the CLI remembers your credentials. The success message should look like this:

Terminal message that reads, “sfdx force:auth:web:login --alias gs0Org --setdefaultusername Successfully authorized [USERNAME

Now that you have set up your environment, you’re ready to start building the dashboard.

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback