The Execute Anonymous Apex tool in the Developer Console runs the Apex code you enter using ExecuteAnonymous and generates a debug log with the results of the execution.

  1. Click Debug | Open Execute Anonymous Window to open the Enter Apex Code window.
  2. Enter the code you want to run in the Enter Apex Code window or click Triangle icon to open the code editor in a new browser window. To automatically open the resulting debug log when execution is complete, select Open Log.
  3. Execute the code

Execute Anonymous Apex Code