Run Apex code in command line

Run Apex Anonymous code in command line

Did you know that you don’t have to open developer console to run apex scripts via Anonymous Apex? You don’t even have to open any IDE or create a text file, simply put your code in…

Did you know that you don’t have to open developer console to run apex scripts via Anonymous Apex? You don’t even have to open any IDE or create a text file, simply put your code in command line interface.

All you have to do is to use the sf command:

bash
sf apex run

This will start interactive shell. You can use enter to go to next line, when you are done with writing your code, use Ctrl+D to execute code

Text and code were extracted from the original slide. Plain-text version of the whole catalog