Prerequisite
- Salesforce CLI
- Visual Studio Code
- ForceCode Extension
Create
Project with ForceCode
- Open VS Code.
- Open Show all commands (ctrl + Shift + P).
- Type/Look for ForceCode: Create Project.
- Specify the Folder you need to store the Project.
- On Bottom Left-hand side you will notice ForceCode Loading...
- On top of the screen, you will be prompted with an option to select the type of your org.
- After selecting your org, you need to specify whether you want to save and compile your files on the go or not. Please select Yes.
- After that, it will take you to your default web browser for authenticating the Salesforce Org.
- After Successful authenticating, your VS Code is ready to use with ForceCode.
Check out an existing Project
- Create a Package.xml file under the src folder of your project.
- You can use Salesforce Package.xml Generator Extension for VS Code to generate the Package.xml
- https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator
- Click on the ForceCode menu on the right-hand side bottom of the page.
- Type Retrieve Package/Metadata and select from the menu.
- Click on Retrieve by Package.xml option.
- You can see the status of retrieve in the bottom bar of the VS code.
- And after successful retrieval, Your files will be available in the src folder.
Edit/Save/Compile
a file
- Open an Apex class.
- Modify something and press Ctrl + S.
- You can check the save and compile status in the ForceCode Extension tab.
- You can Find the ForceCode Extension tab in the left sidebar.
- Similarly, you can create a new Apex Class under the src/classes folder and save it.
- You can follow similar steps for the rest of the elements like LWC, Aura Component, Visualforce, etc.
- Verify your changes in your org.
Bonus Tips
- You can always use salesforce standard CLI commands while working with a ForceCode Project.
- If you need to download and open a new file
- Got to ForceCode menu Open Salesforce File
- A list will appear with the available files which you can download.
- Use ForceCodeLog in to Salesforce for login to a different org.
- Switch between orgs
- Click ForceCode Extension bar in the Left-hand side menu.
- Switch between saved Username from the list to switch different orgs.
- Use Package.xml to deploy the files defined in the package to another org.
- Firstly switch to the org you wish to deploy.
- Got to ForceCode MenuDeploy PackageDeploy from Package.xml.