Professional Documents
Culture Documents
@salesforcedocs
Last updated: December 20, 2016
Copyright 20002016 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,
as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
CHAPTER 1 Data Loader
Data Loader is a client application for the bulk import or export of data. Use it to insert, update,
EDITIONS
delete, or export Salesforce records.
When importing data, Data Loader reads, extracts, and loads data from comma-separated values Available in: both Salesforce
(CSV) files or from a database connection. When exporting data, it outputs CSV files. Classic and Lightning
Experience
Note: If commas arent appropriate for your locale, use a tab or other delimiter. Specify your
delimiter in Data Loader Settings (Settings | Settings). Available in: Enterprise,
Performance, Unlimited,
You can use Data Loader in two different ways: Developer, and
User interfaceWhen you use the user interface, you work interactively to specify the Database.com Editions
configuration parameters, CSV files used for import and export, and the field mappings that
map the field names in your import file with the field names in Salesforce.
Command line (Windows only)When you use the command line, you specify the configuration, data sources, mappings, and
actions in files. This enables you to set up Data Loader for automated processing.
Data Loader offers the following key features:
An easy-to-use wizard interface for interactive use
An alternate command-line interface for automated batch operations (Windows only)
Support for large files with up to 5 million records
Drag-and-drop field mapping
Support for all objects, including custom objects
Can be used to process data in both Salesforce and Database.com
Detailed success and error log files in CSV format
A built-in CSV file viewer
Support for Windows and Mac
To get started, see the following topics:
When to Use Data Loader
Considerations for Installing Data Loader
Note: In previous versions, Data Loader has been known as AppExchange Data Loader and Sforce Data Loader.
1
CHAPTER 2 When to Use Data Loader
In this chapter ... Data Loader complements the web-based import wizards that are
EDITIONS
accessible from the Setup menu in the online application. Refer to
Considerations for the following guidelines to determine which method best suits Available in: both Salesforce
Installing Data your business needs: Classic and Lightning
Loader
Experience
Configure Data
Loader Use Data Loader when: Available in: Enterprise,
Performance, Unlimited,
You need to load 50,000 to 5,000,000 records. Data Loader is Developer, and
supported for loads of up to 5 million records. If you need to Database.com Editions
load more than 5 million records, we recommend you work
with a Salesforce partner or visit the App Exchange for a suitable
partner product.
You need to load into an object that is not yet supported by the import wizards.
You want to schedule regular data loads, such as nightly imports.
You want to export your data for backup purposes.
2
When to Use Data Loader Considerations for Installing Data Loader
Note: Salesforce no longer bundles Java with the Data Loader for Windows installer. To access the page to
Download and install Java on your Windows computer. download Data Loader:
Modify All Data
We recommend that you set the JAVA_HOME environment variable to the directory where
To use Data Loader:
the Java Runtime Environment (JRE) is installed. Doing so ensures that you can run Data
API Enabled
Loader in batch mode from the command line.
AND
The appropriate user
System Requirements for macOS permission for the
operation you are doing,
To use Data Loader for macOS, you need: for example, Create on
accounts to insert new
macOS El Capitan accounts
120 MB of free disk space AND
256 MB of available memory Bulk API Hard Delete
Java JRE 1.8 (only if you configure
Data Loader to use Bulk
Administrator privileges on the machine
API to hard-delete
records)
Installation Considerations
Over time, several versions of the Data Loader client application have been available for download. Some earlier versions were called
AppExchange Data Loader or Sforce Data Loader. You can run different versions at the same time on one computer. However, do
not install more than one copy of the same version.
The latest version is always available in Salesforce. If you have installed the latest version and want to install it again, first remove the
version on your computer.
Tip: If you experience login issues in the command line interface after upgrading to a new version of Data Loader, please try
re-encrypting your password to solve the problem. For information on the password encryption utility, see Encrypt from the
Command Line on page 20.
Note: The Data Loader command-line interface is supported for Windows only.
To make changes to the source code, download the open-source version of Data Loader from https://github.com/forcedotcom/dataloader.
3
When to Use Data Loader Configure Data Loader
Login Considerations
If your organization restricts IP addresses, logins from untrusted IPs are blocked until theyre activated. Salesforce automatically sends
you an activation email that you can use to log in. The email contains a security token that you must add to the end of your password.
For example, if your password is mypassword, and your security token is XXXXXXXXXX, you must enter
mypasswordXXXXXXXXXX to log in.
Data Loader version 36.0 and later supports Web Server OAuth Authentication. See OAuth Authentication for more information.
Data Loader version 36.0 and later supports Salesforce Communities. Communities users always log in with the OAuth option in
Data Loader. To enable OAuth for Communities, the user modifies the config.properties file as follows.
Change the portion in bold in the following line to the login URL of the community. Dont add a forward slash (/) to the end of
the line.
sfdc.oauth.Production.server=https\://login.salesforce.com
For example:
sfdc.oauth.Production.server=
https\://johnsmith-developer-edition.yourInstance.force.com/test
Change the portion in bold in the following line to the hostname of the community.
sfdc.oauth.Production.redirecturi=https\://login.salesforce.com/services/oauth2/success
For example:
sfdc.oauth.Production.redirecturi=
https\:/johnsmith-developer-edition.yourInstance.force.com/services/oauth2/success
The config.properties file is in the conf default configuration directory, which is installed in these locations.
macOS: /Applications/Data\ Loader.app/Contents/Resources/conf/
Windows: %LOCALAPPDATA%\salesforce.com\Data Loader\samples\conf\ for the current user, and
C:\ProgramData\salesforce.com\Data Loader\samples\conf\ for all users
4
When to Use Data Loader Configure Data Loader
Field Description
Insert null values Select this option to insert blank mapped values as null values
during data operations. Note that when you are updating records,
this option instructs Data Loader to overwrite any existing data
in mapped fields.
This option is not available if the Use Bulk API option is
selected. Empty field values are ignored when you update records
using the Bulk API. To set a field value to null when the Use
Bulk API option is selected, use a field value of #N/A.
Assignment rule Specify the ID of the assignment rule to use for inserts, updates,
and upserts. This option applies to inserts, updates, and upserts
on cases and leads. It also applies to updates on accounts if your
organization has territory assignment rules on accounts. The
assignment rule overrides Owner values in your CSV file.
Server host Enter the URL of the Salesforce server with which you want to
communicate. For example, if you are loading data into a
sandbox, change the URL to
https://test.salesforce.com.
Reset URL on Login By default, Salesforce resets the URL after login to the one
specified in Server host. To turn off this automatic reset,
disable this option.
Query request size In a single export or query operation, records are returned from
Salesforce in increments of this size. The maximum value is 2,000
records. Larger values may improve performance but use more
memory on the client.
Generate status files for exports Select this option to generate success and error files when
exporting data.
Read all CSVs with UTF-8 encoding Select this option to force files to open in UTF-8 encoding, even
if they were saved in a different format.
Write all CSVs with UTF-8 encoding Select this option to force files to be written in UTF-8 encoding.
Use European date format Select this option to support the date formats dd/MM/yyyy
and dd/MM/yyyy HH:mm:ss.
5
When to Use Data Loader Configure Data Loader
Field Description
Allow field truncation Select this option to truncate data in the following types of fields
when loading that data into Salesforce: Email, Multi-select Picklist,
Phone, Picklist, Text, and Text (Encrypted).
In Data Loader versions 14.0 and earlier, values for fields of those
types are truncated by Data Loader if they are too large. In Data
Loader version 15.0 and later, the load operation fails if a value
is specified that is too large.
Selecting this option allows you to specify that the previous
behavior, truncation, be used instead of the new behavior in
Data Loader versions 15.0 and later. This option is selected by
default and has no effect in versions 14.0 and earlier.
This option is not available if the Use Bulk API option is
selected. In that case, the load operation fails for the row if a
value is specified that is too large for the field.
Allow comma as a CSV delimiter Select this option if your CSV file uses commas to delimit records.
Allow Tab as a CSV delimiter Select this option if your CSV file uses tab characters to delimit
records.
Allow other characters as CSV delimiters Select this option if your CSV file uses a character other than a
comma or tab to delimit records.
Other Delimiters (enter multiple values The characters in this field are used only if the Allow other
with no separator; for example, !+?) characters as CSV delimiters option is selected.
For example, if you use the | (pipe) character to delimit data
records, enter that character in this field.
Use Bulk API Select this option to use the Bulk API to insert, update, upsert,
delete, and hard delete records. The Bulk API is optimized to load
or delete a large number of records asynchronously. Its faster
than the default SOAP-based API due to parallel processing and
fewer network round-trips.
Enable serial mode for Bulk API Select this option to use serial instead of parallel processing for
Bulk API. Processing in parallel can cause database contention.
When this is severe, the load may fail. Using serial mode
guarantees that batches are processed one at a time. Note that
using this option may significantly increase the processing time
for a load.
This option is only available if the Use Bulk API option is
selected.
6
When to Use Data Loader Data Loader Behavior with Bulk API Enabled
Field Description
Upload Bulk API Batch as Zip File Select this option to use Bulk API to upload zip files containing
binary attachments, such as Attachment records or Salesforce
CRM Content.
This option is only available if the Use Bulk API option is
selected.
Proxy NTLM domain The name of the Windows domain used for NTLM authentication.
Start at row If your last operation failed, you can use this setting to begin
where the last successful operation finished.
7
When to Use Data Loader Configure the Data Loader to Use the Bulk API
Note:
You can also select the Enable serial mode for Bulk API option. Processing in parallel can cause database
contention. When this is severe, the load may fail. Using serial mode guarantees that batches are processed one at a time.
Note that using this option may significantly increase the processing time for a load.
Caution: You can hard delete records when you configure Data Loader to Use Bulk API. Keep in mind that hard deleted
records are immediately deleted and cant be recovered from the Recycle Bin.
8
CHAPTER 3 Using Data Loader
In this chapter ... Using Data Loader, you can perform various operations which
EDITIONS
include exporting data, defining field mappings, inserting, updating,
Data Types and deleting data, performing mass updates and mass deletes, Available in: Salesforce
Supported by Data uploading attachments and content, and reviewing output files. Classic
Loader
Export Data Available in: Enterprise,
Define Data Loader Performance, Unlimited,
Field Mappings Developer, and
Database.com Editions
Insert, Update, or
Delete Data Using
Data Loader
Uploading
Attachments
Upload Content with
the Data Loader
Reviewing Data
Loader Output Files
Data Import Limits
View the Data Loader
Log File
9
Using Data Loader Data Types Supported by Data Loader
10
Using Data Loader Export Data
To enable date formats that begin with the day rather than the month, select the Use European date format box in
the Settings dialog. European date formats are dd/MM/yyyy and dd/MM/yyyy HH:mm:ss.
If your computer's locale is east of Greenwich Mean Time (GMT), we recommend that you change your computer setting to
GMT in order to avoid date adjustments when inserting or updating records.
Only dates within a certain range are valid. The earliest valid date is 1700-01-01T00:00:00Z GMT, or just after midnight on January
1, 1700. The latest valid date is 4000-12-31T00:00:00Z GMT, or just after midnight on December 31, 4000. These values are offset
by your time zone. For example, in the Pacific time zone, the earliest valid date is 1699-12-31T16:00:00, or 4:00 PM on December
31, 1699.
Double
Standard double string
ID
A Salesforce ID is a case-sensitive 15-character or caseinsensitive 18-character alphanumeric string that uniquely identifies a particular
record.
Tip: To ensure data quality, make sure that all Salesforce IDs you enter in Data Loader are in the correct case.
Integer
Standard integer string
String
All valid XML strings; invalid XML characters are removed.
Export Data
You can use the Data Loader export wizard to extract data from any Salesforce object. When you
EDITIONS
export, you can choose to include (Export All) or exclude (Export) soft-deleted records.
1. Open the Data Loader. Available in: both Salesforce
Classic and Lightning
2. Click Export or Export All. These commands can also be found in the File menu.
Experience
3. Enter your Salesforce username and password. Click Log in to log in. After your login completes
successfully, click Next. (Until you log out or close the program, you will not be asked to log in Available in: Enterprise,
again.) Performance, Unlimited,
Developer, and
If your organization restricts IP addresses, logins from untrusted IPs are blocked until theyre Database.com Editions
activated. Salesforce automatically sends you an activation email that you can use to log in. The
email contains a security token that you must add to the end of your password. For example,
if your password is mypassword, and your security token is XXXXXXXXXX, you must enter USER PERMISSIONS
mypasswordXXXXXXXXXX to log in.
To export records:
4. Choose an object. For example, select the Account object. If your object name does not display Read on the records
in the default list, check Show all objects to see a complete list of objects that you can To export all records:
access. The objects will be listed by localized label name, with developer name noted in Read on the records
parentheses. For object descriptions, see the SOAP API Developer's Guide.
5. Click Browse... to select the CSV file to which the data will be exported. You can enter a new
file name to create a new file or choose an existing file.
If you select an existing file, the contents of that file are replaced. Click Yes to confirm this action, or click No to choose another file.
6. Click Next.
11
Using Data Loader Export Data
7. Create a SOQL query for the data export. For example, check Id and Name in the query fields and click Finish. As you follow the
next steps, you will see that the CSV viewer displays all the Account names and their IDs. SOQL is the Salesforce Object Query
Language that allows you to construct simple but powerful query strings. Similar to the SELECT command in SQL, SOQL allows you
to specify the source object, a list of fields to retrieve, and conditions for selecting rows in the source object.
a. Choose the fields you want to export.
b. Optionally, select conditions to filter your data set. If you do not select any conditions, all the data to which you have read access
will be returned.
c. Review the generated query and edit if necessary.
Tip: You can use a SOQL relationship query to include fields from a related object. For example:
Select Name, Pricebook2Id, Pricebook2.Name, Product2Id, Product2.ProductCode FROM
PricebookEntry WHERE IsActive = true
Or:
Select Id, LastName, Account.Name FROM Contact
When using relationship queries in Data Loader, the fully specified field names are case-sensitive. For example, using
ACCOUNT.NAME instead of Account.Name does not work.
Data Loader doesnt support nested queries or querying child objects. For example, queries similar to the following return an
error:
SELECT Amount, Id, Name, (SELECT Quantity, ListPrice,
PriceBookEntry.UnitPrice, PricebookEntry.Name,
PricebookEntry.product2.Family FROM OpportunityLineItems)
FROM Opportunity
Also, Data Loader doesnt support queries that make use of polymorphic relationships. For example, the following query results
in an error:
SELECT Id, Owner.Name, Owner.Type, Owner.Id, Subject FROM Case
For more information on SOQL, see the Force.com SOQL and SOSL Reference.
Note:
Data Loader currently does not support the extraction of attachments. As a workaround, we recommend that you use the
weekly export feature in the online application to export attachments.
If you select compound fields for export in the Data Loader, they cause error messages. To export values, use individual field
components.
12
Using Data Loader Define Data Loader Field Mappings
The insert, update, upsert, delete, and hard delete wizards in Data Loader allow you to add new records, modify existing records, or
delete existing records. Note that upsert is a combination of inserting and updating. If a record in your file matches an existing record,
the existing record is updated with the values in your file. If no match is found, then the record is created as new. When you hard delete
records, the deleted records are not stored in the Recycle Bin and become immediately eligible for deletion. For more information, see
Configure Data Loader on page 4.
1. Open the Data Loader.
2. Click Insert, Update, Upsert, Delete or Hard Delete. These commands can also be found in the File menu.
3. Enter your Salesforce username and password. Click Log in to log in. After your login completes successfully, click Next. (Until you
log out or close the program, you are not asked to log in again.)
If your organization restricts IP addresses, logins from untrusted IPs are blocked until theyre activated. Salesforce automatically sends
you an activation email that you can use to log in. The email contains a security token that you must add to the end of your password.
For example, if your password is mypassword, and your security token is XXXXXXXXXX, you must enter
mypasswordXXXXXXXXXX to log in.
13
Using Data Loader Insert, Update, or Delete Data Using Data Loader
4. Choose an object. For example, if you are inserting Account records, select Account. If your object name does not display in the
default list, check Show all objects to see a complete list of the objects that you can access. The objects are listed by localized
label name, with developer name noted in parentheses. For object descriptions, see the Object Reference for Salesforce and Force.com.
5. Click Browse... to select your CSV file. For example, if you are inserting Account records, you could specify a CSV file named
insertaccounts.csv containing a Name column for the names of the new accounts.
6. Click Next. After the object and CSV file are initialized, click OK.
7. If you are performing an upsert:
a. Your CSV file must contain a column of ID values for matching against existing records. The column may be either an external
ID (a custom field with the External ID attribute), or Id (the Salesforce record ID). From the drop-down list, select which field
to use for matching. If the object has no external ID fields, Id is automatically used. Click Next to continue.
b. If your file includes the external IDs of an object that has a relationship to your chosen object, enable that external ID for record
matching by selecting its name from the drop-down list. If you make no selection here, you can use the related object's Id
field for matching by mapping it in the next step. Click Next to continue.
8. Define how the columns in your CSV file map to Salesforce fields. Click Choose an Existing Map to select an existing field mapping,
or click Create or Edit a Map to create a new map or modify an existing map. For more details and an example of usage, see Define
Data Loader Field Mappings on page 13.
9. Click Next.
10. For every operation, the Data Loader generates two unique CSV log files; one file name starts with success, while the other starts
with error. Click Browse... to specify a directory for these files.
11. Click Finish to perform the operation, and then click Yes to confirm.
12. As the operation proceeds, a progress information window reports the status of the data movement.
13. After the operation completes, a confirmation window summarizes your results. Click View Successes to view your success file,
click View Errors to open your errors file, or click OK to close. For more information, see Reviewing Data Loader Output Files on
page 17.
Tip:
If you are updating or deleting large amounts of data, review Perform Mass Updates and Perform Mass Deletes for tips and
best practices.
There is a five-minute limit to process 100 records when the Bulk API is enabled. Also, if it takes longer than 10 minutes to
process a file, the Bulk API places the remainder of the file back in the queue for later processing. If the Bulk API continues to
exceed the 10-minute limit on subsequent attempts, the file is placed back in the queue and reprocessed up to 10 times before
the operation is permanently marked as failed. Even if the processing failed, some records could have completed successfully,
so you must check the results. If you get a timeout error when loading a file, split your file into smaller files, and try again.
14
Using Data Loader Perform Mass Updates
You can use Data Loader to upload attachments to Salesforce. Before uploading attachments, note
the following:
If you intend to upload via the Bulk API, verify that Upload Bulk API Batch as Zip File on the Settings > Settings
page is enabled.
If you are migrating attachments from a source Salesforce organization to a target Salesforce organization, begin by requesting a
data export for the source organization. On the Schedule Export page, make sure to select the Include Attachments...
checkbox, which causes the file Attachment.csv to be included in your export. You can use this CSV file to upload the
attachments. For more information on the export service, see Export Backup Data from Salesforce.
To upload attachments:
1. Confirm that the CSV file you intend to use for attachment importing contains the following required columns (each column represents
a Salesforce field):
ParentId - the Salesforce ID of the parent record.
Name - the name of the attachment file, such as myattachment.jpg.
Body - the absolute path to the attachment on your local drive.
15
Using Data Loader Upload Content with the Data Loader
Ensure that the values in the Body column contain the full file name of the attachments as they exist on your computer. For
example, if an attachment named myattachment.jpg is located on your computer at C:\Export, Body must specify
C:\Export\myattachment.jpg. Your CSV file might look like this:
ParentId,Name,Body
50030000000VDowAAG,attachment1.jpg,C:\Export\attachment1.gif
701300000000iNHAAY,attachment2.doc,C:\Export\files\attachment2.doc
The CSV file can also include other optional Attachment fields, such as Description.
2. Proceed with an insert or upsert operation; see Insert, Update, or Delete Data Using Data Loader on page 13. At the Select
data objects step, make sure to select the Show all Salesforce objects checkbox and the Attachment
object name in the list.
Note: If there are commas in the description, use double quotes around the text.
VersionData - complete file path on your local drive (for uploading documents only).
Note: Files are converted to base64 encoding on upload. This action adds approximately 30% to the file size.
PathOnClient - complete file path on your local drive (for uploading documents only).
ContentUrl - URL (for uploading links only).
OwnerId - (optional) file owner, defaults to the user uploading the file.
FirstPublishLocationId - library ID.
16
Using Data Loader Reviewing Data Loader Output Files
Note: If you publish to a library that has restricted record types, specify RecordTypeId.
To determine the RecordTypeId values for your organization using Data Loader, follow the steps in Exporting Data. The
following is a sample SOQL query:
Select Id, Name FROM RecordType WHERE SobjectType = 'ContentVersion'
To determine the RecordTypeId values for your organization using the AJAX Toolkit:
a. Log in to Salesforce.
b. Enter this URL in your browser:
http://instanceName.salesforce.com/soap/ajax/38.0/debugshell.html. Enter the
instanceName for your organization. You can see the instanceName in the URL field of your browser after logging
in to Salesforce.
c. In the AJAX Toolkit Shell page, type:
sforce.connection.describeSObject("ContentVersion")
d. Press Enter.
e. Click the arrows for recordTypeInfos.
The RecordTypeId values for your organization are listed.
2. Upload the CSV file for the ContentVersion object (see Insert, Update, or Delete Data Using Data Loader on page 13). All documents
and links are available in the specified library.
17
Using Data Loader Data Import Limits
The success file contains all of the records that were successfully loaded. In this file, there's a column for the newly generated record
IDs. The error file contains all of the records that were rejected from the load operation. In this file, there's a column that describes
why the load failed.
5. Click Close to return to the CSV Chooser window, and then click OK to exit the window.
Note: To generate success files when exporting data, select the Generate status files for exports setting. For
more information, see Configure Data Loader on page 4.
18
CHAPTER 4 Running in Batch Mode (Windows Only)
In this chapter ... Note: The Data Loader command-line interface is supported EDITIONS
for Windows only.
Installed Directories
You can run Data Loader in batch mode from the command line. Available in: Salesforce
and Files
See the topics in this section for more information. Classic
Encrypt from the
Command Line Available in: Enterprise,
Note: If you have used the batch mode from the command
Upgrade Your Batch Performance, Unlimited,
line with a version earlier than 8.0, see Upgrade Your Batch
Mode Interface Developer, and
Mode Interface on page 21.
Database.com Editions
Data Loader
Command-Line
Interface
Configure Batch
Processes
Data Loader Process
Configuration
Parameters
Data Loader
Command-Line
Operations
Configure Database
Access
Map Columns
Run Individual Batch
Processes
19
Running in Batch Mode (Windows Only) Installed Directories and Files
1. Run \bin\encrypt.bat.
2. At the command line, follow the prompts provided to execute the following actions:
20
Running in Batch Mode (Windows Only) Upgrade Your Batch Mode Interface
Generate a key
Key text is generated on screen from the text you provide. Carefully copy the key text to a key file, omitting any leading or trailing
spaces. The key file can then be used for encryption and decryption.
Encrypt text
Generates an encrypted version of a password or other text. Optionally, you can provide a key file for the encryption. In the
configuration file, make sure that the encrypted text is copied precisely and the key file is mentioned.
Verify encrypted text
Given encrypted and decrypted versions of a password, verifies whether the encrypted password provided matches its decrypted
version. A success or failure message is printed to the command line.
21
Running in Batch Mode (Windows Only) Configure Batch Processes
Note: These topics only apply to Data Loader version 8.0 and later.
Tip: If you experience login issues in the command line interface after upgrading to a new version of Data Loader, please try
re-encrypting your password to solve the problem. For information on the password encryption utility, see Encrypt from the
Command Line on page 20.
22
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
For the names and descriptions of available process configuration parameters, see Data Loader Process Configuration Parameters on
page 23.
Write
all
CSVs Select this option to force files to be
with written in UTF-8 encoding.
UTF-8
dataAccess.writeUTF8 boolean encoding Sample value: true
23
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
Generate
status Select this option to generate success and error files
files when exporting data.
for
process.enableExtractStatusOutput boolean exports Sample value: true
24
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
The name of the CSV file that stores error data from
the last operation.
The name of the CSV file that stores success data from
the last operation. See also
string (file process.enableExtractStatusOutput
process.outputSuccess name) N/A on page 24.
25
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
26
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
See
process.enableExtractStatusOutput
on page 24. Stores SOAP messages sent to or from
Salesforce. As messages are sent or received, they are
appended to the end of the file. As the file does not
have a size limit, please monitor your available disk
storage appropriately.
27
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
28
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
29
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
30
Running in Batch Mode (Windows Only) Data Loader Command-Line Operations
31
Running in Batch Mode (Windows Only) Configure Database Access
DataSource
The DataSource bean sets the physical information needed for database connections. It contains the following properties:
driverClassName
The fully qualified name of the implementation of a JDBC driver.
url
The string for physically connecting to the database.
username
The username for logging in to the database.
password
The password for logging in to the database.
Depending on your implementation, additional information may be required. For example, use
org.apache.commons.dbcp.BasicDataSource when database connections are pooled.
The following code is an example of a DataSource bean:
<bean id="oracleRepDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@myserver.salesforce.com:1521:TEST"/>
<property name="username" value="test"/>
<property name="password" value="test"/>
</bean>
Versions of Data Loader from API version 25.0 onwards do not come with an Oracle JDBC driver. Using Data Loader to connect to an
Oracle data source without a JDBC driver installed will result in a Cannot load JDBC driver class error. To add the Oracle JDBC driver to
Data Loader:
Download the latest JDBC driver from
http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html.
Copy the JDBC .jar file to data loader install folder/java/bin.
32
Running in Batch Mode (Windows Only) Spring Framework
Spring Framework
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
The Data Loader configuration files are based on the Spring Framework, which is an open-source, Available in: Salesforce
full-stack Java/J2EE application framework. Classic
The Spring Framework allows you to use XML files to configure beans. Each bean represents an
Available in: Enterprise,
instance of an object; the parameters correspond to each object's setter methods. A typical bean
Performance, Unlimited,
has the following attributes:
Developer, and
id Database.com Editions
Uniquely identifies the bean to XmlBeanFactory, which is the class that gets objects from
an XML configuration file.
class
Specifies the implementation class for the bean instance.
For more information on the Spring Framework, see the official documentation and the support forums. Note that Salesforce cannot
guarantee the availability or accuracy of external websites.
33
Running in Batch Mode (Windows Only) SQL Configuration
SQL Configuration
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
When running Data Loader in batch mode from the command line, the SqlConfig class contains Available in: Salesforce
configuration parameters for accessing specific data in the database. As shown in the code samples Classic
below, queries and inserts are different but very similar. The bean must be of type
com.salesforce.dataloader.dao.database.SqlConfig and have the following Available in: Enterprise,
properties: Performance, Unlimited,
Developer, and
sqlString Database.com Editions
The SQL code to be used by the data access object.
The SQL can contain replacement parameters that make the string dependent on configuration
or operation variables. Replacement parameters must be delimited on both sides by @ characters. For example,
@process.lastRunDate@.
sqlParams
A property of type map that contains descriptions of the replacement parameters specified in sqlString. Each entry represents
one replacement parameter: the key is the replacement parameter's name, the value is the fully qualified Java type to be used when
the parameter is set on the SQL statement. Note that java.sql types are sometimes required, such as java.sql.Date instead
of java.util.Date. For more information, see the official JDBC API documentation.
columnNames
Used when queries (SELECT statements) return a JDBC ResultSet. Contains column names for the data outputted by executing
the SQL. The column names are used to access and return the output to the caller of the DataReader interface.
locs.city,
locs.postal_code,
locs.state,
locs.country,
parties.sic_code
from
ar.hz_cust_accounts accounts,
ar.hz_organization_profiles org,
ar.hz_parties parties,
ar.hz_party_sites party_sites,
ar.hz_locations locs
where
accounts.PARTY_ID = org.PARTY_ID
and parties.PARTY_ID = accounts.PARTY_ID
34
Running in Batch Mode (Windows Only) SQL Configuration
35
Running in Batch Mode (Windows Only) Map Columns
Map Columns
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
When running Data Loader in batch mode from the command line, you must create a properties Available in: Salesforce
file that maps values between Salesforce and data access objects. Classic
1. Create a new mapping file and give it an extension of .sdl.
Available in: Enterprise,
2. Observe the following syntax: Performance, Unlimited,
On each line, pair a data source with its destination. Developer, and
Database.com Editions
In an import file, put the data source on the left, an equals sign (=) as a separator, and the
destination on the right. In an export file, put the destination on the left, an equals sign (=)
as a separator, and the data source on the right.
Data sources can be either column names or constants. Surround constants with double quotation marks, as in sampleconstant.
Values without quotation marks are treated as column names.
Destinations must be column names.
You may map constants by surrounding them with double quotation marks, as in:
"Canada"=BillingCountry
3. In your configuration file, use the parameter process.mappingFile to specify the name of your mapping file.
Note: If your field name contains a space, you must escape the space by prepending it with a backslash (\). For example:
Account\ Name=Name
36
Running in Batch Mode (Windows Only) Run Individual Batch Processes
Note: If you specify a constant value that contains spaces, you must escape the spaces by prepending each with a backslash (\).
For example:
"Food\ &\ Beverage"=Industry
Process Example
process ../conf accountMasterProcess
Note: You can configure external process launchers such as the Microsoft Windows XP Scheduled Task Wizard to run processes
on a schedule.
37
CHAPTER 5 Command-Line Quick Start (Windows Only)
In this chapter ... Note: The Data Loader command-line interface is supported EDITIONS
for Windows only.
Data Loader
This quick start shows you how to use the Data Loader Available in: Salesforce
Introduction
command-line functionality to import data. Classic
Prerequisites
Step One: Create the Available in: Enterprise,
Encryption Key Performance, Unlimited,
Developer, and
Step Two: Create the
Database.com Editions
Encrypted Password
Step Three: Create
the Field Mapping
File
Step Four: Create the
Configuration File
Step Five: Import the
Data
38
Command-Line Quick Start (Windows Only) Data Loader Introduction
SEE ALSO:
Prerequisites
Prerequisites
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
To step through this quick start requires the following: Available in: Salesforce
Data Loader installed on the computer that runs the command-line process. Classic
The Java Runtime Environment (JRE) installed on the computer that runs the command-line Available in: Enterprise,
process. Performance, Unlimited,
Familiarity with importing and exporting data by using the Data Loader interactively through Developer, and
the user interface. This makes it easier to understand how the command-line functionality Database.com Editions
works.
Tip: When you install Data Loader, sample files are installed in the samples directory. This
directory is found below the program directory, for example, C:\Program Files
(x86)\salesforce.com\Apex Data Loader 22.0\samples\. Examples
of files that are used in this quick start can be found in the \samples\conf directory.
SEE ALSO:
Data Loader Introduction
Step One: Create the Encryption Key
39
Command-Line Quick Start (Windows Only) Step One: Create the Encryption Key
4. Create an encryption key by entering the following command. Replace <seedtext> with any string.
encrypt.bat g <seedtext>
Note: To see a list of command-line options for encrypt.bat, type encrypt.bat from the command line.
5. Copy the generated key from the command window to a text file named key.txt and make a note of the file path. In this example,
the generated key is e8a68b73992a7a54.
Note: Enabling quick edit mode on a command window can make it easier to copy data to and from the window. To enable
quick edit mode, right-click the top of the window and select Properties. On the Options tab, select QuickEdit Mode.
The encryption utility is used to encrypt passwords, but data that you transmit using Data Loader is not encrypted.
SEE ALSO:
Data Loader Introduction
Step Two: Create the Encrypted Password
40
Command-Line Quick Start (Windows Only) Step Two: Create the Encrypted Password
2. Copy the encrypted password that is generated by the command. You use this value in a later step.
SEE ALSO:
Data Loader Introduction
Step Three: Create the Field Mapping File
#Mapping values
#Thu May 26 16:19:33 GMT 2011
Name=Name
NumberOfEmployees=NumberOfEmployees
Industry=Industry
41
Command-Line Quick Start (Windows Only) Step Four: Create the Configuration File
Tip: For complex mappings, you can use the Data Loader user interface to map source and destination fields and then save
those mappings to an .sdl file. This is done on the Mapping dialog box by clicking Save Mapping.
SEE ALSO:
Data Loader Introduction
Step Four: Create the Configuration File
42
Command-Line Quick Start (Windows Only) Step Five: Import the Data
value="C:\DLTest\Command Line\Config\accountInsertMap.sdl"/>
<entry key="dataAccess.name"
value="C:\DLTest\In\insertAccounts.csv"/>
<entry key="process.outputSuccess"
value="c:\DLTest\Log\accountInsert_success.csv"/>
<entry key="process.outputError"
value="c:\DLTest\Log\accountInsert_error.csv"/>
<entry key="dataAccess.type" value="csvRead"/>
<entry key="process.initialLastRunDate"
value="2005-12-01T00:00:00.000-0800"/>
</map>
</property>
</bean>
</beans>
3. Modify the following parameters in the process-conf.xml file. For more information about the process configuration
parameters, see Data Loader Process Configuration Parameters on page 23.
sfdc.endpointEnter the URL of the Salesforce instance for your organization; for example,
https://yourInstance.salesforce.com/.
sfdc.usernameEnter the username Data Loader uses to log in.
sfdc.passwordEnter the encrypted password value that you created in step 2.
process.mappingFileEnter the path and file name of the mapping file.
dataAccess.NameEnter the path and file name of the data file that contains the accounts that you want to import.
sfdc.debugMessagesCurrently set to true for troubleshooting. Set this to false after your import is up and running.
sfdc.debugMessagesFileEnter the path and file name of the command line log file.
process.outputSuccessEnter the path and file name of the success log file.
process.outputErrorEnter the path and file name of the error log file.
Warning: Use caution when using different XML editors to edit the process-conf.xml file. Some editors add XML
tags to the beginning and end of the file, which causes the import to fail.
SEE ALSO:
Data Loader Introduction
Step Five: Import the Data
43
Command-Line Quick Start (Windows Only) Step Five: Import the Data
Note: The Data Loader command-line interface is supported for Windows only.
Now that all the pieces are in place, you can run Data Loader from the command line and insert some new accounts.
1. Copy the following data to a file name accountInsert.csv. This is the account data that you import into your organization.
Name,Industry,NumberOfEmployees
Dickenson plc,Consulting,120
GenePoint,Biotechnology,265
Express Logistics and Transport,Transportation,12300
Grand Hotels & Resorts Ltd,Hospitality,5600
SEE ALSO:
Data Loader Introduction
44
APPENDIX A Data Loader Third-Party Licenses
The following third-party licenses are included with the installation of Data Loader:
EDITIONS
Technology Version License Available in: both Salesforce
Number Classic and Lightning
Apache Jakarta Commons 1.6 http://www.apache.org/licenses/LICENSE-2.0 Experience
BeanUtils Available in: Enterprise,
Apache Commons 3.1 http://www.apache.org/licenses/LICENSE-2.0 Performance, Unlimited,
Developer, and
Collections
Database.com Editions
Apache Commons 1.2.1 http://www.apache.org/licenses/LICENSE-2.0
Database Connection
Pooling (DBCP)
Note: Salesforce is not responsible for the availability or content of third-party websites.
45
INDEX
46