Using Visual Studio as Force.com IDE, Import code from cloud to VS

Yup, There is no escaping now, you have to learn to do it with VS Code.

I hate and love Salesforce for this. It's like OnePlus' slogan #NeverSettle






Here is a new way to get the metadata components from salesforce instances and it is part of the Visual studio experience. 

If you are here just to learn How-to, skip the following blabbering and start with "Steps to get metadata from your Salesforce Org.".

I liked using eclipse, it was clumsy but still easy to use, it had all the options. Its not just that, we have some more options, chrome extension, Salesforce Inspector,  RIP - MavensMate and many more. Everyone has their own favorite. With all the changes in the development on the new platform, I guess we have to get used to the recommended approach, which is Visual Studio, VS Code. 

There is actually more to this story, a propaganda. We are required to go through these items, in the name of FUN, COOL, WOW, where are these could be as easy as "RightClick + Create Project + Add/ Retrieve Items from Org + Create/ Update items + Save/ Deploy to Org". 

Some insights: It is a good to know the Core platform of building and deploying, hence we need to learn the deployment platform (Metadata API), this is difference from the Apex/ Lightning or other salefsorce dev capabilities. Also, when a new platform is built, it is easy to release it with just the command prompts rather than building an entire UI solution to it with all the popup dialogs.
The other idea is to make familiar with the sfdx command family, make you use the CLI so you can have world of opportunities, hence more time away from the loved ones. 


Steps to get metadata from your Salesforce Org:

Step 1: 
Install Visual Studio and Install SFDX CLI

Step 2: 
> Open VS, On the left side click the Visual Studio Code's Extension icon icon, it opens up Extensions place.
> Search for Salesforce Extension Pack and click Install.
> Restart the VS Code application.
Step 3: 
> Open VS code:
> Ctrl+Shift+p
> Type in : Create Project with manifest
> Enter Project Name and Select/ Create a new folder. this is your new workspace
> Now you need to connect your salesforce org, the way you do it with this new tool is that you run a command. Remember everything we do is gonna start with "Ctrl+Shift+P" 
> Ctrl+Shift+p and then type in "Authorize an Org.", pick an instance type (Prod/ dev, sandbox etc..) 
> Provide an alias or you can skip it.
> It will open up browser, you login with username and password, allow access to CLI.
> That should connect the org to VS Code, now you can access metadata which means now you can retrieve the metadata from the org too.
> Remember, we have created the Project with manifest which has the package.xml with all the popular metadata components, 


> Right click anywhere on the left side and do "Retrieve source from org"


> It should get you all those in your package.xml in few mins. I got mine:




If you dont want to go through all these pain, use Salesforce inspector and get the metadata, I will post that soon, it is also an easy way.

HTH
Prabhanjan


Comments

Popular posts from this blog

Lightning spinner inside Button

Passing URL parameters to controller in Lightning components/ AURA

Nested AURA:IFs in Lightning Components Salesforce