Hacks, Habits and Helpful Hints : The salesforce Admin's reference guide. This short guide explain how to use the salesforce data loader in a command line; No more clics, no more errors.
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Salesforce Admin's guide : the data loader from the command line
1.
2. 1. Using Data Loader from the command line - Salesforce
Using the Salesforce Data Loader is convenient but laborious ...
Convenient because it is possible to retrieve any Salesforce database object : contacts,
customers, prospects, current opportunities, active users ...
But the handling is long because you only have to repeat orders in the GUI : copy / paste ID
and password, scan existing objects, select one, validate, select fields to export, possibly
building filters, validate, revalidate and produce the CSV file under the directory you
precised. Things are repeated more or less for other manipulations such as insert, update
and upsert adding the choice of the mapping file. And this sometimes several times per day.
So little interest to the user that he will see from a benevolent eye the automation off all
this. Good new, the use of Salesforce Data Loader in text mode is possible (-:
You just need to know if you connect to the internet via a proxy or live.
2. Start by creating a new directory on your PC
Create SF subdirectory D:Data(To change depending on your PC configuration, yours
needs)
Go to C:Program Files (x86)salesforce.comData Loader (possibly adjusted according to the
installation directory of your data loader)
Copy the bin directories, Java, Samples and dataloader-XX.0.0 uber.jar to D:DataSF. These
directories are used regardless of the type of operation performed: insert, export ...
Create directory export D:DataSFexport, D:DataSFimport, D:DataSFupdate,
D:DataSFupsert
3. Create three empty files :
key.txt, config.properties, process-conf.xml (confirm properties and xml extensions despite
the Windows warning messages). Place them in D:DataSFexport
These directory and files are used for a single operation: export Salesforce data.
The principle is to separate the files containing the SQL query to export (Salesforce's called
SOQL) and the file with passwords for maintenance issues. When you change your password,
there is only one place to change them!
4. Configure the files:
We first set config.properties:
#Loader Config
3. #03/04/2015
#sfdc.debugMessages=true
#sfdc.debugMessagesFile = D:Donneessfinsert1AccountExport.log these 2 lines are comments
process.encryptionKeyFile=D:DonneesSFinsertkey.txt #way to your key.txt file don’t forget the
sfdc.endpoint=https://login.salesforce.com
sfdc.username=your_salesforce_email #No « « no ‘’
sfdc.password=To-INQUIRE we will come back to this
sfdc.proxyUsername=ID proxy
sfdc.proxyPassword= To-INQUIRE we will come back to this
sfdc.proxyHost= proxy parameters see in your internet brownser
sfdc.proxyPort= proxy parameters see in your internet brownser
sfdc.loadBatchSize=100
sfdc.timeoutSecs=600
This is where things get complicated a bit. Passwords must be encrypted. For this, Salesforce
provides an encryption program. (you copy the bin directory did you ?)
You must start the Windows’s console (under Start Menu, Search programs and files, type
cmd).
Step 1: Move to the bin directory with the command cd "cd D:DataSFbin" (remember DOS
commands ?). Type the following command : encrypt.bat
TheTextYouWantImagineAnythingYouWant -g
Figure 2 CMD window in Windows 7
Copy and paste the result of the command in the encryption key.txt file. no need to put "".
Save changes. Pay attention to space, no spKey.txt close the file. End of the step 1.
4. Step 2: Always in the console, always under D:DataSFbin, run the following command
encrypt.bat YourProxipassword –e "D:DataSFimportkey.txt".
Step 3: Password encryption password Salesforce + token concatenated without spaces.
Always in the console, always under D:DataSFbin, run the following command encrypt.bat
YourSalesforcePasswordWith theEncryptedToken –e " D:DataSFexportkey.txt". Set aside
the encrypted password generated.
Step 4: Open the config.propertie file. The goal is to complete all the parameters with the
encrypted passwords obtained.
1. Your ID recognized by the proxy
2. Your CDMrecognized by the proxy and encrypted now
3. Your Login Salesforce
4. Your MDP + Salesforce token concatenated and encrypted now
Save changes.
Work on the config.properties file is finished.
We configure process-conf.xml by copying this in-process conf.xml
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-
beans.dtd">
<beans>
<!--
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooo
ooooooooooooooooooooooooooo PREMIER EXTRACT
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -->
<!-- RESTE A METTRE LA DATE DANS LE FICHIER EN SORTIE ET REGLER LES REPERTOIRES pour
SAUVEGARDER -->
<!-- LES CSV Exports a deposer dans les repertoires habituels D:X_RepDepotFiles_TmpMAJ Salesforce_
Extract Cptes Distrib_Users
puis creer les .bat et la doc d'installation -->
<bean id="ExtractUser"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>ExtractUser job gets User info from salesforce and saves info into a CSV file.</description>
<property name="name" value="ExtractUser"/>
5. <property name="configOverrideMap">
<map>
<!-- Attention pour le moment 12/02/2015, concernant les commentaires les caracteres accentues ne passent
pas dans l'export et provoquent des erreurs
Ligne de commande process.bat "D:DonneesSFtest" ExtractUser -->
<!-- Fichiers de logs -->
<entry key="sfdc.debugMessages" value="true"/>
<entry key="sfdc.debugMessagesFile" value="D:DonneesSFtestlogExtractUser.log"/>
<!-- Parametres extraction Salesforce idema config du dataloader-->
<entry key="sfdc.timeoutSecs" value="600"/>
<entry key="sfdc.loadBatchSize" value="200"/>
<entry key="sfdc.entity" value="Account"/>
<entry key="sfdc.extractionRequestSize" value="500"/>
<entry key="sfdc.entity" value="User"/>
<!-- requete SOQL-->
<entry key="sfdc.extractionSOQL" value="Select Id, LastName, FirstName, Username, CommunityNickname,
CompanyName, Division, Department, Title, City, Email, IsActive, UserRoleId, ProfileId, UserType,
DelegatedApproverId, ManagerId, LastLoginDate, CreatedDate, LastModifiedDate, DesactivOrderDat__c,
CreatedById, LastModifiedById, IsPortalEnabled, PerId__c, Agence__c, EmployeeNum__c, BU__c,
Pointdevente__c, Brand__c, Username__c, LDAPLogin__c, RegDCDiv__c, SousRegion__c, Marche__c,
CompanyName__c, PerformId__c, resp_workflow_dae__c, MultiPDV__c, CodeEnseigne__c FROM User"/>
<!-- Nom du process, pour nous extract, possibilite de faire toutes les autres operation a condition d'avoir
fichier sdl et regler-->
<entry key="process.operation" value="extract"/>
<!-- reglage export, fichier sortie, et logs en cas d'erreur -->
<entry key="dataAccess.type" value="csvWrite"/>
<entry key="dataAccess.readUTF8" value="true"/>
<entry key="dataAccess.writeUTF8" value="true"/>
<entry key="dataAccess.name" value="D:Donnees_ Extract Cptes Distrib_UsersUser_Salesforce.csv"/>
<entry key="process.outputError" value="D:DonneesSFtestlogErrorExtractUser.csv"/>
</map>
6. </property>
</bean>
</beans>
Some explanations. The most important part of the file is the following entry:
<entry key = "sfdc.extractionSOQL" value = "Select ID, LastName, FirstName, Username,
CommunityNickname, CompanyName, Division, Department, Title, City, Email, IsActive,
UserRoleId, ProfileId, UserType, DelegatedApproverId, ManagerID, LastLoginDate,
CreatedDate , LastModifiedDate, DesactivOrderDat__c, CreatedById, LastModifiedById,
IsPortalEnabled, PerId__c, Agence__c, EmployeeNum__c, BU__c, Pointdevente__c,
Brand__c, Username__c, LDAPLogin__c, RegDCDiv__c, SousRegion__c, Marche__c,
CompanyName__c, PerformId__c, resp_workflow_dae__c, MultiPDV__c, CodeEnseigne__c
FROM User "/>
This part is the SOQL order. It could for example be adapted as follows according your needs
:
<entry key = "sfdc.extractionSOQL" value = "Select * FROM User" />
Just copy and paste your usual application as it appears in your Data Loader window
between characters "."
There is a second important input is <bean id = "ExtractUser" we will return.
5. Creating execution file
We reach the goal, go to the office, export.bat create the file, copy the following lines.
echo off
cd "D:DataSFbin"
process.bat start "D:Datasfexport" ExtractUser this tell you something?
6. Operation:
Double click on the file export.bat. After some time, you will have the query result in a cvs
file located under D:Data_ Extract CPTES Distrib_Users
Then simply to provide a task to run automatically, for example to recover your PC to start
the file without anything to do.
7. Futur
7. It is possible to export more by .XML file. It is possible to do insert, update and upsert, any
operation you do with the data loader. We will return if you suggest us to.
Thanks !