question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SFDC: Execute Anonymous Apex with Editor Contents command not found

See original GitHub issue

Summary

The following command runs fine.

sfdx force:apex:execute -f scripts/apex/character.apex -u dev

But attempting to run character.apex from vscode with the extension pack installed results in the following error.

vscode-error

This has been working. I recently updated the cli to latest. Perhaps it’s related to that?

Steps To Reproduce:

  1. command-shift-p .SFDX: Execute Anonymous Apex with Editor Contacts

Expected result

attempts to run anonymous apex on currently connected org

Actual result

error displayed above. (looks like command is missing?)

Additional information

see screen shot

See above Salesforce Extension Version in VS Code: v53.12.0

SFDX CLI Version: sfdx-cli: Updating CLI… already on latest version: 7.132.0-6621068

OS and version: Darwin falcon.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:05 PST 2021; root:xnu-7195.141.14~1/RELEASE_ARM64_T8101 arm64

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pogilviecommented, Jan 11, 2022

I really am enjoying the execute anonymous apex button!

1reaction
pogilviecommented, Jan 11, 2022

Thank you for pointing me on the right path @randi274! Everyone was solve with a setting update. I’m so glad that I don’t need to maintain two java installations.

This documentation is clear: https://developer.salesforce.com/tools/vscode/en/getting-started/java-setup#:~:text=It requires an installation of,environment variable on your computer. working

Read more comments on GitHub >

github_iconTop Results From Across the Web

SFDX: Execute Anonymous Apex with editor contents (Results ...
Hi Friends, I have made a query with a sub-query in the VS-Code using the command SFDX: Execute Anonymous Apex with editor contents....
Read more >
How to run Apex anonymous code from Visual Studio Code
Select Anonymous Apex as language for the file. enter image description here. SFDX: Execute Anonymous Apex with Editor Contents (I made it as ......
Read more >
How to execute Apex anonymous code from Visual Studio Code
Once your anonymous piece of code is ready Click Ctrl+Shift+P to open command Pallete where you can see the command sfdx: Execute Anonymous...
Read more >
Apex: Basics and Anonymous Execution - YouTube
You'll learn how to run Apex code with anonymous execution.Intr... ... Quickstarts: Setting Up Your Salesforce Developer Tools: ...
Read more >
ForceCode - Visual Studio Marketplace
Commands · Compile · Run Apex Unit Tests · Execute Anonymous · Create scratch org · Open · Bundle and Deploy Static Resource...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found