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

20 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
  10. Hi Amit,

    maybe you can help me. When I'm running test classes in VS code, got different coverages in each time, or the classes that the test passed are not showned all...you have any idea about the root cause? Thank you.

    ReplyDelete
  11. How to compile all classes in vs code?

    ReplyDelete
  12. Nice Blog...! It is really useful for me and I expect from you more updating about this title. Thank you!!!
    Spousal Support in Virginia
    Virginia Spousal Support

    ReplyDelete
  13. Such a wonderful post and this is really helpful for me. Thank you!
    pvc foam board manufacturers in kerala

    ReplyDelete
  14. This piece does a fantastic job of simplifying a complex subject. I genuinely appreciate how the writer made it so easy to understand. Great work! Visit our link for ISO Certification in Saudi Arabia

    ReplyDelete