Tuesday, 4 September 2018

VS CODE for Salesforce | Visual Studio Code for Salesforce |

In this post we will talk about how to setup VsCode for salesforce. We can use the VsCode with ForceCode Extensions or with SalesforceDx. If you want to learn about SalesforceDX for Non-Scratch Org check this post.

Option 1) VsCode With SalesforceDX :-

 If you want to setup VsCode with salesforceDx. Check this recording.

https://www.youtube.com/watch?v=7qR0c8h5cCU

After watching above recording you will able to perform below activity.
  1. Install VsCode from here.
  2. Install Salesforce Extension 
  3. Create project with non Scratch Org
  4. How to create Apex Class
  5. Execute Test Class
    • To retrieve code coverage results when you run Apex tests, edit your workspace settings and set  salesforcedx-vscode-core.retrieve-test-code-coverage to true.
  6. Execute Anonymous Apex with Editor Contents
  7. Execute SOQL
  8. Debug log in VsCode


Option 2) Setup VS Code with ForceCode Extension :-

Step 1) Install VsCode. Click here to download.(Please use 1.24 version)
Step 2) Install SFDC CLI   https://developer.salesforce.com/tools/sfdxcli


Step 3) Install the Salesforce Extension for VS Code. and "ForceCode" Extensions.




Step 3) Restart the VS Code.
Step 4) Click on File --> Open Folder--> Select your folder which you want to use.


Step 5) Press "CTL+SHIFT+P" then Type "ForceCode Menu"


Step 6) Enter User Name and password.


Step 7) Then Import the project by "Get All Files from org" or "Package.xml" option





Reference Link :-
1) https://developer.salesforce.com/blogs/2018/02/salesforce-extensions-vs-code.html


Thanks,
Amit Chaudhary
Capture.JPG  @amit_sfdc    #SalesforceApexHours    @ApexHours
  Salesforce Apex Hours

14 comments:

  1. Thanks Amit. You can also use Salesforce package.xml generator vs code extension to choose metadata using point and click like in Force.com IDE plugin.

    https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator

    ReplyDelete
  2. Thanks Amit. I was able to get the development started in VSCode thanks to your blogpost today.

    ReplyDelete
  3. Hi Amit. Thanks for the post. I tried the above steps, all components got exported to xml except lWC Components. Could you please help me to export lwc components as well.

    ReplyDelete
    Replies
    1. Can you please share your package.xml file ? I hope you added LWC Component and version is 45 ?

      Delete
  4. I have follwed all the above steps but its keep on asking me Error: "ForceCode: the SFDX cli is not found"

    ReplyDelete
    Replies
    1. Did u get any solution for this , i am also facing the same issue

      Delete
    2. Salesforce CLI is installed in my system and extension pack is also there and path is set properly still m getting this error again and again

      Delete
  5. Hi Amit,
    I installed Vs Code connect the org and I get all source code from sandbox but next day i opened come check Try retrieve the code Got an Error "cannot read property 'parent' of undefined" .

    Please tell me the suggestion.
    Thanks and Regards,
    Kamesh

    ReplyDelete
  6. stunning and brave

    ReplyDelete
  7. Hi, I don't see "Get All Files from org" option. Which extension it comes from?

    ReplyDelete
  8. I tried retrieving using package.xml. That does not work. It says "Either the file/metadata type doesn't exist in the current org or you're trying to save/retrieve outside of c:\Users\Downloads\C Drive\Dev1\src

    ReplyDelete
  9. how to validate the vs code

    ReplyDelete