How to run Apex anonymous code from Visual Studio Code

Is it possible / How would I run a block of Apex anonymous code from Visual Studio Code?

Answer

In the command palette, if you type “sfdx ex” you will be offered this if you have some Apex text selected:

SFDX: Execute Anonymous Apex with Currently Selected Text

or this:

SFDX: Execute Anonymous Apex with Editor Contents

if you don’t.

Not too sure why there is also this .apex file thing too. As the project is open source you can see open issues, all issues, pull requests etc here https://github.com/forcedotcom/salesforcedx-vscode/issues.

Attribution
Source : Link , Question Author : Robs , Answer Author : Keith C

Leave a Comment