SOQL Tasks

SOQL Tasks

This repository contains sample SOQL tasks that you can complete in Code Builder or VS Code using the Salesforce Extensions. We constantly add to this list, so make sure you visit this topic often.

Create a Query That Lists Accounts with a New York State Address

  1. From the Command Palette, run SFDX: Create Query in SOQL Builder to open SOQL Query Builder.
  2. Click File > Save to save the file. Make sure to retain the .soql file extension.
  3. Click the Switch Between SOQL Builder and Text Editors icon () to reopen the SOQL Query Builder.
  4. In the From field, search object, and select the Account object.
  5. In Fields, select Name, BillingState, and BillingCountry.
  6. In the Filter field, select AND, and set: BillingCountry = USA AND BillingState = NY
  7. Click Run Query.

A Query Result tab pops up. You can then save the result in csv or json formats.


Trailhead – Write SOQL Queries

Feedback or Bugs | Edit this Article