How to set up Salesforce Data Loader Command Line Interface or CLI?

How to set up Salesforce Data Loader Command Line Interface or CLI?

1. Navigate to Setup –> Data –> Data Loader.

2. Download the data loader.

3. Install it following the wizard.

Note:
Make sure Command Line Tools and Samples option are selected in the wizard.

4. Make sure JAVA is installed in your machine by running “java -version” command on your Command Prompt Window.

5. Navigate to Program Files –> Data Loader –> bin in command prompt and run encrypt.bat –k. It will generate dataLoader.key file.

6. Run encrypt.bat -e YOURORGPASSWORD “KeyFileLocation.dataloaderdataLoader.key” to get the password in encrypted form.

7. Create DataLoaderFiles folder or create a folder with your name choice outside Program Files folder. In my case I have created in C drive. Path is C:DataLoaderFiles.

8. Navigate to C:Program Files (x86)salesforce.comData Loadersamplesconf to get some sample sdl files. Update it as per your request.

9. Create the mapping file by putting the CSV file header name on left side and Salesforce API name on right side. Move the mapping file to  C:DataLoaderFiles location. I have used the below sdl file for extracting account.

  1. #Mapping values for Account Extract  
  2. Id=Id  
  3. Name=Name  

Note:
Make sure to add all the fields you are trying to retrieve it in the sdl file.

10. Navigate to C:Program Files (x86)salesforce.comData Loadersamplesconf to get process-conf.xml file.

11. Move the process-conf file to  C:DataLoaderFiles location.

12. Edit the file and enter your information.

  1. <!DOCTYPE beans PUBLIC “-//SPRING//DTD BEAN//EN” “http://www.springframework.org/dtd/spring-beans.dtd”>  
  2. <beans>  
  3.   
  4.     <bean id=”csvAccountExtractProcess”  
  5.           class=”com.salesforce.dataloader.process.ProcessRunner”  
  6.           singleton=”false”>  
  7.       <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file.”</description>  
  8.         <property name=”name” value=”csvAccountExtract”/>  
  9.         <property name=”configOverrideMap”>  
  10.             <map>  
  11.                 <entry key=”sfdc.debugMessages” value=”false”/>  
  12.                 <entry key=”sfdc.debugMessagesFile” value=”C:DataLoaderFilessfdcSoapTrace.log”/>  
  13.                 <entry key=”sfdc.endpoint” value=”https://login.salesforce.com”/>  
  14.                 <entry key=”sfdc.username” value=”YOUR USERNAME”/>  
  15.                 <entry key=”sfdc.password” value=”ENCRYPTED PASSWORD”/>  
  16.                 <entry key=”process.encryptionKeyFile” value=”C:Usersmagulan.dataloaderdataLoader.key”/>  
  17.                 <entry key=”sfdc.timeoutSecs” value=”600″/>  
  18.                 <entry key=”sfdc.loadBatchSize” value=”200″/>  
  19.                 <entry key=”sfdc.entity” value=”Account”/>  
  20.                 <entry key=”sfdc.extractionRequestSize” value=”500″/>  
  21.                 <entry key=”sfdc.extractionSOQL” value=”SELECT Id, Name FROM Account”/>  
  22.                 <entry key=”process.operation” value=”extract”/>  
  23.                 <entry key=”process.mappingFile” value=”C:DataLoaderFilesaccountExtractMap.sdl”/>  
  24.                 <entry key=”dataAccess.type” value=”csvWrite”/>  
  25.                 <entry key=”dataAccess.name” value=”C:DataLoaderFilesextract.csv”/>  
  26.             </map>  
  27.         </property>  
  28.     </bean>  
  29.       
  30. </beans>  

Note:
Make sure to add all the fields you are trying to retrieve it in the extractionSOQL attribute. Make sure the sdl file also have those fields for the mapping.

13. Put process-conf and mapping sdl file into the new folder. In my case I have used C:DataLoaderFiles.

14. Run process C:DataLoaderFiles csvAccountExtractProcess to extract the data.
Note:
Make sure you are in Data Loader’s bin folder to execute the command from the Command Prompt.

Leave a Reply