Modern Salesforce Developer Tools Hands-on Training

1. Code Builder

1.1 Sign up for a Salesforce org

  1. Follow your instructor's instructions to get a Salesforce org provisioned with Code Builder.
  2. Write down your user ID and password for later use.
  3. Go to login.salesforce.com and log in to your org.

1.2 Enable and launch Code Builder

Step 1: Launch Code Builder

  1. Click the Setup icon (gear icon in the upper right corner), and click Setup.
  2. In Quick Find, search for Code Builder, and select Code Builder.
  3. Dismiss the error message (due to pre-installation of Code Builder).
  4. Click the Enable Code Builder toggle. Review and accept the license agreement.
  5. Click the App Launcher icon (waffle icon in the upper left corner), and select the Code Builder app.
  6. 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 continuing.

Step 2: Create an SFDX Project

  1. Open the command palette (Press CMD+SHIFT+P on Mac or CTRL+SHIFT+P on PC).
  2. Search for SFDX and click on "SFDX: Create Project with Manifest".
  3. Click Standard.
  4. Enter MODERN_TOOLS_WORKSHOP for the project name and press Return.

Step 3: Authorize your Org

  1. Open the command palette (Press CMD+SHIFT+P on Mac or CTRL+SHIFT+P on PC).
  2. Search for "Authorize an Org". If not available, wait for Code Builder to fully initialize.
  3. Select "SFDX: Authorize an Org".
  4. Select Project Default.
  5. Enter MODERN-TOOLS-WORKSHOP for the org alias and press Return.
  6. Click Connect.
  7. Log in to your org using your credentials.
  8. Click Allow.
  9. Click Continue.

2. Retrieving Metadata from the Development Org

2.1 Retrieving Custom Objects Metadata Using Org Browser

Step 1: Open the Org Browser

  1. In the VSCode Activity Bar, click on the Salesforce icon to open the Org Browser.

Step 2: Expand the Metadata Types

  1. In the Org Browser panel, expand the metadata types by clicking on the dropdown arrows.

Step 3: Locate Custom Objects

  1. Scroll down and locate the CustomObject metadata type.

Step 4: Retrieve Custom Objects Metadata

  1. Click on the CustomObject metadata type to view all custom objects available in your org.
  2. Click the download icon (cloud with a down arrow) at the top of the Org Browser panel to retrieve the selected custom objects' metadata.

Step 5: Confirm Retrieval

  1. The metadata will be retrieved and stored in your project's force-app/main/default/objects directory.

3. Create an Apex Class PersonalizedExperiencesController

Step 1: Open the Command Palette

  1. Press Ctrl+Shift+P (Windows) or Cmd+Shift+P (Mac).

Step 2: Create Apex Class

  1. Type SFDX: Create Apex Class and select it.

Step 3: Provide Class Details

  1. Enter PersonalizedExperiencesController as the class name.
  2. Select the default directory for the class (usually force-app/main/default/classes).

Step 4: Confirm Creation

  1. The new PersonalizedExperiencesController class file will be created and opened in the editor.

4. Einstein for Developers (Beta)

4.1 Activate Einstein for Developers

Activate Einstein for Developers

4.2 Create a Prompt to generate the Apex class

Use the following prompt:

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
Einstein for Developers Prompt

5. Code Analyzer

5.1 Install Code Analyzer CLI Plugin

  1. Open the Integrated Terminal:
    • Using the Menu:
      1. Click on View in the top menu bar.
      2. Select Terminal from the dropdown menu.
    • Using Shortcut Key:
      1. Press Ctrl + Shift + ` on your keyboard.
    • Using Command Palette:
      1. Press Ctrl + Shift + P to open the Command Palette.
      2. Type Toggle Integrated Terminal and select it from the list.
  2. Run the following command in the terminal:
    sf plugins install @salesforce/sfdx-scanner

5.2 Install Code Analyzer VSCode Extensions

  1. Open the Extensions View:
    • Using the Sidebar:
      1. Click on the Extensions icon in the Activity Bar on the side of the window. It looks like a square icon.
    • Using Shortcut Key:
      1. Press Ctrl + Shift + X (Windows) or Cmd + Shift + X (macOS) on your keyboard.
  2. Search for the Extension:
    1. In the Extensions view, there is a search bar at the top.
    2. Type Salesforce Code Analyzer into the search bar and press Enter.
  3. Select the Extension:
    1. From the search results, locate the "Salesforce Code Analyzer" extension.
    2. Click on the extension to view its details page.
  4. Install the Extension:
    1. On the extension's details page, click the Install button.
    2. Wait for the installation to complete. You will see a progress indicator and a message once the installation is finished.
  5. Activate the Extension:
    1. Some extensions might require you to reload VSCode to activate. If prompted, click the Reload button or restart VSCode manually.

5.3 Scan for Code Vulnerability

Code Analyzer Scan