-
Follow the instructions of your instructor to get a Salesforce org provisioned with Code Builder.
-
Make sure you write down your user id and password. You'll need them again later in this workshop.
-
In your browser, go to login.salesforce.com and log in to your org.
-
Click the Setup icon (gear icon in the upper right corner), and click Setup.
-
In Quick Find, search for Code Builder, and select Code Builder.
-
Dismiss the error message. This is due to the pre-installation of Code Builder.
-
Click the Enable Code Builder toggle to enable Code Builder. Review and accept the license agreement.
-
Click the App Launcher icon (waffle icon in the upper left corner), and select the Code Builder app.
-
In the Code Builder Dashboard, click the Launch button.
TIP: It will take a few minutes for Code Builder to fully initialize. Wait for the Let’s Get You Started page to appear before you continue.
-
Open the command palette (Press CMD+SHIFT+P on Mac or CTRL+SHIFT+P on PC).
-
Search SFDX and Click on SFDX: Create Project with Manifest
-
Click Standard
-
Enter MODERN_TOOLS_WORKSHOP for the project name and press Return.
The project will now load and next we authorize as shown below.
-
You need to connect Code Builder to your org to be able to deploy code:
-
Open the command palette (Press CMD+SHIFT+P on Mac or CTRL+SHIFT+P on PC).
-
Search for Authorize an Org. If it is not yet available, wait Code Builder to fully initialize. If this command is not available please follow the steps below to create a new project.
-
Select SFDX: Authorize an Org.
-
Select Project Default.
-
Enter MODERN-TOOLS-WORKSHOP for the org alias and press Return.
-
Click Connect.
-
Log in to your org using your credentials.
-
Click Allow.
-
Click Continue.
1 In the VSCode Activity Bar, click on the Salesforce icon to open the Org Browser.
- In the Org Browser panel, expand the metadata types by clicking on the dropdown arrows.
- Scroll down and locate the CustomObject metadata type.
- Click on the CustomObject metadata type to view all custom objects available in your org.
- Click the download icon (cloud with a down arrow) at the top of the Org Browser panel to retrieve the selected custom objects' metadata.
- The metadata will be retrieved and stored in your project's
force-app/main/default/objects
directory.
- Press
Ctrl+Shift+P
(Windows) orCmd+Shift+P
(Mac).
- Type
SFDX: Create Apex Class
and select it.
- Enter
PersonalizedExperiencesController
as the class name. - Select the default directory for the class (usually
force-app/main/default/classes
).
- The new
PersonalizedExperiencesController
class file will be created and opened in the editor.
Generate a class PersonalizedExperiencesController with method name getMatchingExperiences. The method has a parameter of contact Id and the method fetches Experience records matching type field by fields Interest1__c or Interest2__c or Interest3__c from the contact record. Keep the query static
- Open the Integrated Terminal:
- Using the Menu:
- Click on
View
in the top menu bar. - Select
Terminal
from the dropdown menu.
- Click on
- Using Shortcut Key:
- Press
Ctrl
+Shift
+`
on your keyboard.
- Press
- Using Command Palette:
- Press
Ctrl
+Shift
+P
to open the Command Palette. - Type
Toggle Integrated Terminal
and select it from the list.
- Press
- Using the Menu:
- Run the below command in the terminal
sf plugins install @salesforce/sfdx-scanner
-
Open the Extensions View:
- Using the Sidebar:
- Click on the Extensions icon in the Activity Bar on the side of the window. It looks like a square icon.
- Using Shortcut Key:
- Press
Ctrl
+Shift
+X
(Windows) orCmd
+Shift
+X
(macOS) on your keyboard.
- Press
- Using the Sidebar:
-
Search for the Extension:
- In the Extensions view, there is a search bar at the top.
- Type
Salesforce Code Analyzer
into the search bar and pressEnter
.
-
Select the Extension:
- From the search results, locate the "Salesforce Code Analyzer" extension.
- Click on the extension to view its details page.
-
Install the Extension:
- On the extension’s details page, click the
Install
button. - Wait for the installation to complete. You will see a progress indicator and a message once the installation is finished.
- On the extension’s details page, click the
-
Activate the Extension:
- Some extensions might require you to reload VSCode to activate. If prompted, click the
Reload
button or restart VSCode manually.
- Some extensions might require you to reload VSCode to activate. If prompted, click the