Visual Code to AzureDevops | Visual Code to Salesforce
Steps to connect local project from VS Code to Azure DevOps:
1. Install Visual Code.
2. Install all the salesforce extensions.
3. Install Git on your system.
4. Go to your Azure account.
5. Select the Project you want to clone.
6. Go to Repos
7. Click on the Clone link present on the right-hand side. It will give multiple options where you can clone the project. Select VSCode.
8. It will ask for permission to open the Visual Code. Click Ok.
9. The Visual Code will open a folder browsing dialog box. Select the folder where you want to clone the project.
10. The project will get cloned.
11. Go to Command Palette (CTRL+Shift+P) and select Team: SignIn.
12. Select “Authenticate and get an access token automatically”.
This will generate a token. Copy it and press enter. It will redirect you to browser for Login.
13. Enter the token you copied and proceed. Now, it will ask for Username and password. Once authenticated, you can start working.
14. After making any changes in the project, you can see files changed in the Source Control section. See the image below.
15. + sign at the right side of the changed file indicates that it can be staged. This means instead of pushing complete project every time, we can stage specifically those changes that we want to commit. Once clicked on plus sign, click on Commit staged option, as shown above, the file will get published on GitHub.
Steps to connect Salesforce from VS code:
1. Install SFDX in your system.
2. Connect to salesforce Account from Visual Code.
Go to View-> Command Palette or press CTRL+SHIFT+P. You will see an option “SFDX: Authorize An Org”. Click on it. You will see below options:
Select the type of login you want. You will be redirected to the selected URL. Once successfully logged in, you will be asked to close the browser if you want to.
3. How to save changes to salesforce on saving file:
Go to File-> Preferences->Settings-> Code Actions On Save-> Open settings.json file. Add below line to the end of the JSON and save it.
This enables the build process every time you press CTRL+S. The content will get saved to the salesforce server.