Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Salesforce SOQL & Apex RunnerNew to Visual Studio Code? Get it now.
Salesforce SOQL & Apex Runner

Salesforce SOQL & Apex Runner

aabid-salesforce-tools

|
4 installs
| (0) | Free
Execute SOQL queries and Anonymous Apex with debug logs - similar to Illuminated Cloud
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Salesforce SOQL & Apex Runner

A VSCode extension that provides a comprehensive interface for executing SOQL queries and Anonymous Apex code against Salesforce orgs, similar to Illuminated Cloud's functionality in IntelliJ.

Features

  • SOQL Query Execution: Execute SOQL queries and view results in a formatted table
  • Anonymous Apex Execution: Run Anonymous Apex code and view debug logs
  • Multi-Org Support: Configure and switch between multiple Salesforce orgs
  • Bottom Panel Interface: Integrated panel similar to VSCode's terminal
  • Real-time Results: View query results and debug logs in real-time

Installation

  1. Install the dependencies:

    npm install
    
  2. Compile the TypeScript code:

    npm run compile
    
  3. Press F5 to launch the extension in a new Extension Development Host window

Usage

Opening the Extension

  • Use the command palette (Ctrl+Shift+P / Cmd+Shift+P) and search for "Open Salesforce SOQL & Apex Runner"
  • Or use the keyboard shortcut Ctrl+Shift+S / Cmd+Shift+S

Adding a Salesforce Org

  1. Click "Add Org" in the extension panel
  2. Fill in the required fields:
    • Org Name: A friendly name for your org
    • Instance URL: Your Salesforce instance URL (e.g., https://mycompany.my.salesforce.com)
    • Access Token: Your Salesforce access token
    • API Version: Salesforce API version (default: 58.0)

Getting an Access Token

To get an access token for your Salesforce org:

  1. Using Browser/Connected App:

    • Set up a Connected App in your Salesforce org
    • Use OAuth flow to get an access token
  2. Using SFDX CLI (if you have it installed):

    sfdx force:org:display --verbose -u your-org-alias
    
  3. Using VS Code Salesforce Extension:

    • If you have the official Salesforce Extension Pack installed
    • Check the .sfdx folder in your project for org information

Running SOQL Queries

  1. Select "SOQL" mode
  2. Choose your target org from the dropdown
  3. Enter your SOQL query in the text area
  4. Click "Run"

Example SOQL query:

SELECT Id, Name, Email, CreatedDate 
FROM Contact 
WHERE CreatedDate = TODAY 
LIMIT 10

Running Anonymous Apex

  1. Select "Anonymous Apex" mode
  2. Choose your target org from the dropdown
  3. Enter your Apex code in the text area
  4. Click "Run"

Example Anonymous Apex:

System.debug('Hello World!');

List<Account> accounts = [SELECT Id, Name FROM Account LIMIT 5];
for (Account acc : accounts) {
    System.debug('Account: ' + acc.Name);
}

// Create a new contact
Contact newContact = new Contact(
    LastName = 'Test',
    Email = 'test@example.com'
);
insert newContact;
System.debug('Created contact with ID: ' + newContact.Id);

Configuration

The extension stores org configurations in VSCode settings. You can also manually edit them:

  1. Open VSCode settings (Ctrl+, / Cmd+,)
  2. Search for "salesforce-runner"
  3. Edit the "Orgs" configuration

Security Notes

  • Access tokens are stored in VSCode settings
  • Be careful not to commit access tokens to version control
  • Consider using environment variables or secure storage for production use
  • Access tokens can be rotated/revoked from your Salesforce org

Troubleshooting

Common Issues

  1. "Org not found" error: Make sure you've selected an org from the dropdown
  2. Authentication errors: Verify your access token is valid and hasn't expired
  3. SOQL errors: Check your SOQL syntax and object/field permissions
  4. Apex compilation errors: Review the debug logs for compilation issues

Debug Information

The extension provides detailed error messages in the results panel. For additional debugging:

  1. Open VSCode Developer Tools (Help > Toggle Developer Tools)
  2. Check the Console tab for extension logs
  3. Look for network errors or API response details

Development

Building from Source

  1. Clone the repository
  2. Install dependencies: npm install
  3. Compile: npm run compile
  4. Run: Press F5 in VSCode

Project Structure

├── src/
│   ├── extension.ts      # Main extension entry point
│   └── salesforce-api.ts # Salesforce API integration
├── package.json          # Extension manifest
├── tsconfig.json         # TypeScript configuration
└── README.md            # This file

License

MIT License - feel free to use and modify as needed.

Contributing

Feel free to submit issues and pull requests to improve the extension!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft