Prepare Your Org to Access the Models API
Learning Objectives
After completing this unit, you’ll be able to:
- Set up your Salesforce DX environment.
- Sign up for an AI Playground.
- Authorize your AI Playground in Visual Studio Code.
- Create a Salesforce DX 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, limited-time 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.
- Make note of your org's expiration date and complete this badge before then.
If you haven’t already, launch your AI playground.
- Click the gear icon () and click Setup. The Setup page opens in a new tab.
- In the Quick Find search box, type
Einstein Setup
.
- Click Einstein Setup to open the Einstein Setup page.
- Turn on Einstein to use generative AI features across your Salesforce Org.
Install the Salesforce Command Line Interface (CLI)
Use the Salesforce CLI to control the full application life cycle of your Salesforce apps. With it you can easily create environments for development and testing, synchronize source code between your orgs and version control system (VCS), and execute tests.
See the Salesforce CLI Setup Guide for complete installation instructions.
- Install the CLI from Salesforce CLI.
- Confirm the CLI is properly installed and on the latest version by running the following command from the command line.
sf update
You should see output like Updating CLI…
Install Salesforce Extensions for Visual Studio Code
Visual Studio Code is the go-to code editor for Salesforce developers. It's free, open-source, and available for Windows, Linux, and macOS. This editor has easy-to-install extensions for syntax highlighting, code completion, and more.
If you don’t already have them, follow the instructions to install Visual Studio Code and the recommended Salesforce Extension Pack.
- Download and install the latest version of Visual Studio Code for your operating system. If you already have Visual Studio Code installed, there’s no need to reinstall it.
- Launch Visual Studio Code.
- On the left toolbar, click the Extensions icon( ).
- Search for
Salesforce Extension Pack
and click Install.
Create a Project
- In Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
- Type
SFDX
.
- Select SFDX: Create Project.
- Press Enter to accept the standard option.
- Enter
ModelsAPILWC
as the project name.
- Press Enter.
- Select a folder to store the project.
- Click Create Project. You should see something like this as your base setup.
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.
Authorize Your AI Playground
In VS Code, authorize your custom Playground.
- In Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
- Type
SFDX
.
- Select SFDX: Authorize an Org.
- Press Enter to accept the Project Default login URL option.
- Press Enter to accept the default alias. This opens the Salesforce login in a separate browser window.
- Log in using your AI Playground credentials.
- If prompted to allow access, click Allow.
- After you authenticate in the browser, the CLI remembers your credentials. The success message should look like this:
You’re now ready to complete the challenge and move on to the next unit. Note that this challenge only checks if Einstein is enabled in Setup, but all of the previous steps are required to start building the dashboard in the next unit.