I retrieved source files from org using SFDX commands in VS code and then I updated some code and saved the file.

However, when I try to run the anonymous debugger using SFDX: Execute Anonymous Apex with Editor Contents, I can see that the executed code is not the updated code.

How can I debug or test the local changes in VS code without pushing the change to org?

1 Answer 1


You need to deploy the file (right-click > SFDX: Deploy Source to Org) before running the script. Alternatively, you can use an auto-deploy setting/extension, such as Mohith Shrivastava's extension. The readme describes how to install this (requires two steps).

  • Isn't there a way to debug without pushing the changes to org? Apr 8, 2020 at 2:21
  • @SachiDangalla No, execute anonymous runs on the server.
    – sfdcfox
    Apr 8, 2020 at 2:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .