Friday, September 12, 2014

Using the CLI CLI tool allows you to interact directly with from your command-line.
Functionality includes exporting metadata and packages created in SFDC to a local directory, browsing data objects, executing SOQL queries, executing APEX code,managing custom objects etc.

Download Force.CLI from

Download CLI executable file and store it in some folder. Suppose my folder name is "CLI Demo" present in E: drive.

Now Open Command prompt  and go to CLI Demo Folder and use below commands:
E:\CLI Demo>force version

If you are getting version information then it means CLI is configured correctly. Otherwise if you getting some error, then set system variable by navigating computer->my properties-Advanced system settings->Environment variables. Provide CLI Demo folder location in path variable.

Once CLI is configured properly, then we can use it to export package created in SFDC to local directory. Follow below steps:
  1. Create a package: Go to SetUp-> Create->Packages. Create a new package and include all elements which you want to export from SFDC.
  2.          Now you can go to command prompt and enter following commands:
             First we need to login to SFDC instance in order to fetch package

        For Production and developer sandbox use
        force login  -u=USERNAME  -p=PASSWORD+SECURITYTOKEN
        force login -u=USERNAME  -p=PASSWORD+SECURITYTOKEN

       For Sandbox
        force login -u=USERNAME  -p=PASSWORD+SECURITYTOKEN

            To fetch package details:

      force fetch package PACKAGENAME --unpack

      In our case package name is “ForceCLIDemoPackage” so enter

      fetch package ForceCLIDemoPackage --unpack

Now metadata folder is created in CLI Demo folder which contain all components information present in package. If you open it, you will see package.xml containing all components list.

Note: If you deploy components in SFDC org using Workbench, then CLI will help you create package.xml file easily. You don’t have to manually create package.xml file. Just create package in your source org and Fetch it with CLI and the zip all contents (package.xml and all folders present in ForceCLIDemoPackage). After this deploy the zip file using workbench to target org.

Available commands:
   login     Log in to
   logout    Log out from
   logins    List logins used
   active    Show or set the active account
   whoami    Show information about the active account
   sobject   Manage standard & custom objects
   field     Manage sobject fields
   record    Create, modify, or view records
   bulk      Load csv file use Bulk API
   fetch     Export specified artifact(s) to a local directory
   export    Export metadata to a local directory
   fetch     Export specified artifact(s) to a local directory
   import    Import metadata from a local directory
   query     Execute a SOQL statement
   apex      Execute anonymous Apex code
   oauth     Manage ConnectedApp credentials
   version   Display current version
   update    Update to the latest version
   push      Deploy single artifact from a local directory
   password  See password status or reset password
   help      Show this help

Run 'force help [command]' for details.


  1. Great article. Very helpful thanks

  2. This comment has been removed by the author.

  3. Nice information thank you,if you want more information please visit our link salesforce online training
    salesforce login

  4. Secondary Memory: It would serve well to take a moment to learn about another memory type - the Secondary Memory IPU. At times it is necessary to retain the program for future use. The Primary Memory would not serve this purpose and this comes in the Secondary Memory also called the "Backing Storage".

  5. Good information though, I want essay services online in canada. Does anyone suggest me ?