1

My VS Code project is already authorised with Salesforce sandbox and I am able to deploy or retrieve the files successfully.

How can I launch the Salesforce org from the currently opened apex class or aura comp or any other metadata.

4
  • 1
    what are you trying to achieve here? Dec 4, 2019 at 20:52
  • Primarily I just want to double check that my current project is pointing to the right Salesforce instance as I doubt that the code is not getting refresh even I just run the retrieve command recently and this is a common requirement to open your current apex class(or any other metadata) in browser. Dec 4, 2019 at 21:09
  • 1
    @sunilgupta are you looking to open the instance in a browser or open the component that is currently open in VS Code in the browser?
    – Jayant Das
    Dec 4, 2019 at 21:21
  • How are you retrieving the apex class? You can check your default org set in the vs code. Dec 4, 2019 at 21:22

1 Answer 1

2

There is a SFDX Command to open the current org that VS Code is working against:

> SFDX: Open Default Org

enter image description here

Additionally, on the bottom left of the status bar the currently connected org alias is shown and clicking the icon besides it opens the org.

enter image description here

Under the hood both the "Open Default Org" and status strip button do the same thing. They issue the SFDX command:

> sfdx force:org:open

If you wanted to drive that directly into a particular location you could extend that with the -p/--path command line option. However, that would require knowing the correct landing URL for the metadata type currently being viewed. Not many metadata types have a direct view URL format.

2
  • Thanks Daniel, that's what I was looking for, on top of that I have one more question - While working with a static resource (an individual HTML file) in VS Code, I found that html file is not retrieving the latest code from the org even the retrieve command showing successfully, is that a limitation with VS Code when you work on static resources. Dec 4, 2019 at 21:52
  • 1
    @sunilgupta I'd recommend asking a new question for that specific problem. That way you will get more direct answers. The comment sections aren't great for longer discussions outside of the original question. Dec 5, 2019 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.