function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nashle PakNashle Pak 

How to download elements of an organization with Visual Studio Code?


Hello to all, $

Usually, I use HaoIDE with Sublime Text.

With HaoIDE, I have the possibility to recover elements of my organization to modify them in local: class apex, component lightning, ...

I understand that Salesforce DX pushes us to go through a repository.

But I would like to know if a feature that allows me to recover existing code directly on an organization exists please.

Thank you in advance !
Best Answer chosen by Nashle Pak
Tad Aalgaard 3Tad Aalgaard 3
Example on how to retrieve a single file - command must be run inside of the project location

sfdx force:source:retrieve --sourcepath c:\salesforce\YOURPROJECT\force-app\main\default\classes\YOURCLASS.cls

Documentation
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm


 

All Answers

Tad Aalgaard 3Tad Aalgaard 3
You can use SFDX to pull classes, code and components from your org.  I currently use Visual Studio Code with SFDX commands that were installed via the Extension area.  It works pretty well.  I can retrieve and deploy classes, triggers, components, lightning, etc from inside of Visual Studio Code.

You could also look into using Salesforce Ant Migration Tool.  I also use it to pull down classes, triggers, permission sets, reports, etc on a daily basis so I can back it up into our own repository or use it to compare production code to my own local copy.
Nashle PakNashle Pak
Bonjour Tad Aalgaard 3,

To begin, I thank you for your responsiveness.
But then what is the command of the CLI used to retrieve the classes and components of my environment please?

I yet consult the help with the command "?" but I did not find the command to download on my pc the lightning classes and components of my organization.
Tad Aalgaard 3Tad Aalgaard 3
Example on how to retrieve a single file - command must be run inside of the project location

sfdx force:source:retrieve --sourcepath c:\salesforce\YOURPROJECT\force-app\main\default\classes\YOURCLASS.cls

Documentation
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm


 
This was selected as the best answer
Nashle PakNashle Pak
Thank you very much ;-)