1

I have connecting command prompt to salesforce using below commands.

D:
cd salesforce CLI
cd bin
sfdx force:auth:web:login -d -a DevHub

But i cant able to connect Visual studio code to salesforce. i have installed visual studio code in my system. at the same time Salesforce CLI Integration and Salesforce Extension Pack also installed. but selecforce connecting commands are not showing.

how to connect visual studio code to salesforce. And what are the commands we need to pass.

1
  • There are no commands to pass; once everything is installed, it should just work. Have you (a) restarted VS Code and/or (b) restarted your computer? Also, if Salesforce CLI is not in your %PATH%, VS Code will not be able to work with it. I recommend restarting and/or reinstalling Salesforce DX to see if that fixes things.
    – sfdcfox
    Commented Jan 17, 2019 at 6:43

3 Answers 3

1

In order to connect VSCode to Salesforce orgs, you need to install:

When you have SFDX Cli and Salesforce Extension Pack installed you need to create a project folder for your org. You can either run the following command in terminal/command prompt

sfdx force:project:create --projectname "name of your's project folder" --manifest

or in VSCode open "Command Pallete" and type SFDX: Create Project and follow the wizard.

enter image description here

After you have a project folder in SFDX format you will be able to connect it to the Salesforce org. To do so you have a few options:

  • Authorize a new org through the cli and set it as default for the current project (you need to run that command from the project folder)
sfdx force:auth:web -a "alias-for-the-org" --setdefaultusername
  • Set previously authorized org as the default org for the current project
sfdx force:config:set defaultusername=alias-for-another-org
  • Open "Org Launcher" in the VSCode and select previously authorized org / authorize a new one

enter image description here

0

I had the same issue of not connecting to salesforce but I followed below link and was able to reinstall everything.

change the org to your org in project-scratch-def.json and use SFDX: Authorize an org https://trailhead.salesforce.com/content/learn/projects/quickstart-vscode-salesforce/start-vscode

1
0

Step 1) Download and Install VsCode
Step 2) Install Salesforce DX CLI
Step 3) Install Salesforce Extension Pack
Open your VsCode and Click on Extensions icon on left hand side or press CTRL+SHIFT+X. Then Search for “Salesforce Extension Pack” and click on install button.Till this step your software setup is completed.
Step 4) Create Project
To Create the project open Command Palette or press Ctrl + Shift + P.
Then type "SFDX: Create Project with Manifest". Then provide your project name and select location where you want to save your project.
Step 5) Connect with your Salesforce Org
Open Command Palette or press Ctrl + Shift + P. This time we need to type or Select “SFDX: Authorize an Org“.
Step 6) Retrieve Component
Open Package.xml file from Manifest folder. Then Modify your Package.xml file to add and remove component. Finally Click on Package.xml and select “SFDX: Retrieve This Source from Org” option
Step 7) Deploy component
Do your changes in VSCode and then select the file which you want to deploy in your org. Then Right click on VsCode and select “SFDC: Deploy This Source to Org” option for deployment.

You must log in to answer this question.

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