Salesforce Development

Setting up Salesforce Organization

Before starting anything with salesforce we need to set up our salesforce environment, to do so navigate to https://developer.salesforce.com/ and click signup on the top right of the menu bar.

Developers page

 

Fill up the form(s) required and once the signup is completed. Log in with your developer account and you can explore salesforce.

Install Salesforce command-line interface

First of all, Instal VS Code along with download the CLI installer from the salesforce official website,  https://developer.salesforce.com/tools/sfdxcli. Follow the installer setup to install the CLI on your machine. After the installation is completed, open up the terminal/command window and enter sfdx. The command should return the resultset with usage and version of the CLI upon successful installation.

Install Salesforce command line interface

Install Salesforce extension

If Visual Studio Code is already installed in previous steps, we can follow the following steps to install Salesforce extension for visual studio code. Launch the visual studio code and click on the extension icon from the side menu bar and enter the “Salesforce Extension pack” in the search box. Select the one created by salesforce and click install.

Install Salesforce extension

After the installation is completed, restart VS-Code if required. Now Go to View>Command Palette and Type SFDX,

It should display a list of commands if the installation is complete.

Salesforce extension action vscode

Creating a project

Lunch Visual studio code and open command palette.On command palette type “SFDX:Create Project” and click enter. Choose the template for the project as required.

sf Create a new project

Provide a name for the project and select a location for the project. After the Project has been created, open “project-scratch-def.json” located inside the config folder and change the organization name to your organization

project json

Authorizing the organization

After creating the project, we need to authorize our organization so that we can deploy our changes to our salesforce organization directly from our VS code development setup. Open Command Palette and Type “SFDX:Authorize An Org”.

Authorize a environment

Choose the URL from project default or any other you would like to use to authenticate. The project default is set at sfdx-project.json file as sfdxLoginURL.

Create project new

Provide an alias and press enter. It will then redirect you to a salesforce login page, provide your salesforce username and password and click login. After successful login, you’ll be prompted with a consent page requesting the required permissions, Accept It.
The Organization should be now be authorized, you can confirm by typing “SFDX:Open Default Org” in the command palette. This command will open your organization’s Salesforce env in the default browser with you as logged in user.

Open env in browser

Or in command palette type “SFDX: Display Org details for default org: and hit enter

And it will return the following result on the VS Code terminal window.

Sf environment details

After the above steps have been done, we can now write code, test and deploy them to our remote salesforce organization from visual studio code. Salesforce lets you write code in its custom programming language APEX. Version Control such as git and svn can be also be used.

Deploying Code to Salesforce

To deploy the code to the salesforce from visual studio code, right-click the folder or file that you want to deploy.

Deploy code to sf

This will publish the code to your salesforce environment.

Creating Package

For creating the package, From Setup, enter Packages in the Quick Find box, then select Packages Manager should appear under sub-section Packaging under Apps.

Create a package

Click on Package Manager, and the Package manager page will Appear. The managed package is to be packaged for the installation and also ready for publishing on the App Exchange Market place. Steps to Create package includes

package manager page

create package page

package manage detail page

package manager component

Package created

upload package

This installation URL can be used on another salesforce instance to install the package.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *