Author - StudySection Post Views - 16,505 views
Salesforce-CLI

Setup for Salesforce CLI and making VS code authorization of an Org through CLI in Linux

To set up a Salesforce organization on Visual Studio code at the Linux platform, firstly you need to download the TAR file of the Salesforce CLI (sfdxcli).

The Salesforce CLI is a set of commands and a powerful command-line tool that helps in simplifying development and automating the building process when working with your organization. It helps in synchronizing source code between organizations and source repositories.

Download Salesforce CLI –

To download the Salesforce CLI sfdx in your system use the following link.
https://developer.salesforce.com/tools/sfdxcli

  • Go to the link and download the Linux version TAR file to your system.
  • After downloading the sfdx tar file, go to the terminal and make a directory with the help of the command
    mkdir ~/sfdx
    sf-cli
  • Then locate your downloaded TAR file and unzip it with the command
    tar xJf Downloads/sfdx-linux-x64.tar.xz -C ~/sfdx –strip-components 1
    sf-cli1
  • Now update your PATH environment variable for the current terminal session.
    export PATH=~/sfdx/bin:$PATH
    sf-cli2
  • Use the sfdx command to check if the sfdx is installed correctly or not. Simply write sfdx and enter.
    sf-cli3
  • If salesforce CLI is successfully installed then you will get this output on the screen.
    sf-cli4

You can do the same steps for installing the Salesforce CLI through VS code terminal.
sf-cli5

Note:- You have to set the PATH environment variable every time you open the VS code after closing it properly. The sfdx commands will only run if the path is set. So repeat the environment setting step whenever you open the VS code.

As your Salesforce CLI is successfully working so now we need to create a project in the VS code and authorize an Org to retrieve/ deploy your code.

Steps to create a project

  • Using the Command Palette, you can create a project. Press Ctrl+Shift+P to open the Command Palette and type Project
    Salesforce CLI 6
  • Click Enter and you will see an option to select which type of project template you want to use, Choose Standard for now.
    Salesforce CLI 7
  • Now it will open the option to enter the Project name, so enter your project name accordingly and click enter.
    Salesforce CLI 8

Now your VS Code project has been successfully created.
Salesforce CLI 9

As your project is created successfully. So now we need to connect our VS Code project folder to Organization.

Authorize an Organization through Command Line

Use the sfdx commands to authorize an organization through VS code.
sfdx force:auth:web:login -a <Your Organization URL>
Salesforce CLI 10

Use -a in your auth command to login to the default login page of Salesforce.
sf-cli11

Use -r in your auth command if you want to login to your custom URL.
sfdx force:auth:web:login -r <Your Custom Organization URL>

sf-cli12

By using -r in the command, the browser will open the login page of your custom URL passed after it.
sf-cli13

By login into it, you will receive a message in the terminal of successfully authorized to use the organization.
sf-cli14

To view all lists of organizations connected through your VS code. Use force:org:list command.
sfdx force:org:list
sf-cli15

jQuery presents a tree-like structure of all the elements on a webpage simplifying the syntax and further manipulating such elements. The jQuery Certification exam by StudySection will secure your fundamental knowledge and a basic understanding of jQuery as an asset to improve your skills.

Leave a Reply

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

fiteesports.com rivierarw.com cratosroyalbet betwoon grandpashabet grandpashabet giriş deneme bonusu veren siteler casino siteleri