Salesforce: Spring '11

Data Loader Developer's Guide

Last updated: April 10, 2011
© Copyright 2000-2011 salesforce.com, inc. All rights reserved. Salesforce.com 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.

Table of Contents

Table of Contents
Data Loader.........................................................................................................................................1
Data Loader Overview..............................................................................................................................................................1 When to Use the Data Loader..................................................................................................................................................2 Installing and Configuring the Data Loader.............................................................................................................................3 Using Data Loader....................................................................................................................................................................9 Running Batch Processes........................................................................................................................................................18 Data Loader Third-Party Licenses..........................................................................................................................................35 Index...................................................................................................................................................................................................37

i

Table of Contents

ii

and the field mappings that map the field names in your import file with the field names in Salesforce. the Data Loader reads. and actions in files used for automated processing. Note: If you are currently using Windows 2000. When exporting data. Unlimited. or set up automated batch processes launched from the command line. When you set up batch processes through the command line. To get started. and Developer Editions The Data Loader is a client application for the bulk import or export of data. and loads data from comma separated values (CSV) files or from a database connection. it outputs CSV files. When you use the user interface. data sources. see the following topics: • • When to Use the Data Loader Installing the Data Loader 1 . delete. you specify the configuration.DATA LOADER Data Loader Overview Available in: Enterprise. Use it to insert. use a tab or other delimiter. You can use Data Loader interactively through its user interface. or export Salesforce records. Note: If commas are not appropriate for your locale. When importing data. update. CSV files used for import and export. mappings. you work interactively to specify the configuration parameters. an open source version of Data Loader is available here. including custom objects Detailed success and error log files in CSV format A built-in CSV file viewer Support for Windows 7 and Windows XP In addition. The 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 Support for large files with up to 5 million records Drag-and-drop field mapping Support for all objects. extracts. we encourage you to use Data Loader on Windows 7 instead.

such as nightly imports. or lead email address. You want to export your data for backup purposes. If you need to load more than 5. The object you need to import is supported by the web-based import wizards. You need to load into an object that is not yet supported by web-based importing. the Data Loader has been known as the “AppExchange Data Loader“ and the “Sforce Data Loader. Use Web-based importing when: • • • You are loading less than 50. You want to prevent duplicates by uploading records according to account name and site. contact email address. we recommend you work with a Salesforce.000 records.Data Loader When to Use the Data Loader Note: In previous versions.000. You want to schedule regular data loads. Refer to the following guidelines to determine which method of importing best suits your business needs: Use the Data Loader when: • • • • You need to load 50.000 records.com partner. 2 .000 to 5.000. and Developer Editions The Data Loader complements the web-based import wizards that are accessible from the Setup menu in the online application.000 records.” When to Use the Data Loader Available in: Enterprise. Unlimited.

Double-click the downloaded file to launch the InstallShield wizard. Unlimited. Some versions were released with earlier product names such as “AppExchange Data Loader” or “Sforce Data Loader. and Developer Editions User Permissions Needed To access the page to download the Data Loader: To use the Data Loader: “Modify All Data” The appropriate user permission for the operation you are doing. 256 MB available memory. Note: If you are currently using Windows 2000.Installing and Configuring the Data Loader Installing the Data Loader INSTALLING AND CONFIGURING THE DATA LOADER Installing the Data Loader Available in: Enterprise. 1. click Your Name ➤ Setup ➤ Data Management ➤ Data Loader. Click Download the Data Loader and save the installer to your PC. 5. multiple versions of the Data Loader client application have been available for download. do not install multiple copies of the same version.5 or later (Windows XP or Windows 7). for example. we encourage you to use Data Loader on Windows 7 instead.” You can run different versions at the same time on one computer. “Create” on accounts to insert new accounts System Requirements To use the Data Loader. If you have previously installed the latest version and want to install it again. Accept the license agreement and click Next. In the online application. The latest version is always available from Salesforce at Your Name ➤ Setup ➤ Data Management ➤ Data Loader. 4. 90 MB free disk space. Different versions have different entries in the Add or Remove Programs dialog in your Windows Control Panel. Sun JVM 1. Installation Procedure Caution: Over time. Java JRE 1. first remove it from your computer by using the Add or Remove Programs dialog in the Windows Control Panel. you need: • • • • • Windows 7 or Windows XP. 3 .5 or later (Windows XP or Windows 7). 3. Click Next. However. You can run the Data Loader wizards or run the application from the command line. 2.

Note that when you are updating records. Configuring the Data Loader Available in: Enterprise. Unlimited. 1. and Developer Editions Use the Settings menu to change the default operation settings of the Data Loader. 9. if your password is mypassword. To start the Data Loader. you must enter mypasswordXXXXXXXXXX to log in. The maximum value is 10. Tip: If you experience login issues in the command line interface after upgrading to a new version of the Data Loader. Click Finish. This option is not available if the Use Bulk API option is selected.Installing and Configuring the Data Loader Configuring the Data Loader 6. 2. Insert Null Values Enable this option to insert blank mapped values as null values during data operations. and your security token is XXXXXXXXXX. or choose Start ➤ All Programs ➤ salesforce. update. The maximum value is 200. double-click the Data Loader icon on your desktop. to choose another directory. see Encrypting From the Command Line on page 19. or click Change. Click Install. Start the Data Loader by choosing Start ➤ Programs ➤ salesforce.. Edit the fields as desired: Field Batch Size Description In a single insert. Click Next. use a field value of #N/A. Empty field values are ignored when you update records using the Bulk API. The email contains a security token that you must add to the end of your password. 8. For information on the password encryption utility. Logging In to the Data Loader If your organization restricts IP addresses. this option instructs the Data Loader to overwrite any existing data in mapped fields.com ➤ Data Loader ➤ Data Loader. upsert. For example. 4 . Salesforce automatically sends you an activation email that you can use to log in. Choose Settings ➤ Settings.com ➤ Data Loader ➤ Data Loader. 7..000 if the Use Bulk API option is selected. Accept the default installation directory. or delete operation. 3. To set a field value to null when the Use Bulk API option is selected. records moving to or from Salesforce are processed in increments of this size. logins from untrusted IPs are blocked until they're activated. please try re-encrypting your password to solve the problem. We recommend a value between 50 and 100.

It also applies to updates on accounts if your organization has territory assignment rules on accounts. truncation. Select this option to support the date formats dd/MM/yyyy and dd/MM/yyyy HH:mm:ss. records are returned from Salesforce in increments of this size.000. values for fields of those types are truncated by the Data Loader if they are too large. change the URL to https://test. Enter the URL of the Salesforce server with which you want to communicate.0 and earlier. Text. Salesforce resets the URL after login to the one specified in Server Host. This option forces files to open in UTF-8 encoding. Larger values may improve performance. Selecting this option allows you to specify that the previous behavior. You may want to disable compression if you need to debug the underlying SOAP messages. By default. Select this option to generate a success file when exporting data. disable this option. Picklist. updates. and upserts on cases and leads.Installing and Configuring the Data Loader Configuring the Data Loader Field Assignment Rule Description Specify the ID of the assignment rule to use for inserts. In a single export or query operation. Multi-select Picklist. To turn off this automatic reset. updates. Compression enhances the performance of the Data Loader and is turned on by default. To turn off compression. Phone. Specify how many seconds the Data Loader waits to receive a response back from the server before returning an error for the request. In Data Loader versions 14. For example. enable this option. be used instead of the new behavior in Server Host Reset URL on Login Compression Timeout Query Request Size Generate success files for exports Read all CSVs with UTF-8 encoding Write all CSVs with UTF-8 encoding Use European Date Format Allow field truncation 5 . Select this option to direct the Data Loader to truncate data in the following types of fields when loading that data into Salesforce: Email. This option applies to inserts. The assignment rule overrides Owner values in your CSV file. In Data Loader version 15.salesforce. and upserts. This option forces files to be written in UTF-8 encoding. and Text (Encrypted).com. the load operation fails if a value is specified that is too large. but use more memory on the client. The maximum value is 2.0 and later. if you are loading into a sandbox. even if they were saved in a different format.

the time zone of the computer where Data Loader is installed is used. The administrative permission for this operation. This option is only available if the Use Bulk API option is selected. Valid values are any time zone identifier which can be passed to the Java getTimeZone(java.0 and later. Processing in parallel can cause database contention. • • If no value is specified.lang. In that case. Enable serial mode for Bulk API Select this option to use serial instead of parallel processing for the Bulk API. Bulk API Hard Delete.0 and earlier. A Salesforce user license is required for hard delete. Caution: When you select the Hard Delete operation. Time zone If a date value does not include a time zone. If an incorrect value is entered. upsert. Note that using this option may significantly increase the processing time for a load. and hard delete records. Using serial mode guarantees that batches are processed one at a time. GMT is used as the time zone and this fact is noted in the Data Loader log. such as Attachment records or Salesforce CRM Content. Use Bulk API Select this option to use the Bulk API to insert. This option is not available if the Use Bulk API option is selected. The value can be a full name such as 6 .Installing and Configuring the Data Loader Configuring the Data Loader Field Description Data Loader versions 15. delete. Instead.String) method. When this is severe. It is faster than the default SOAP-based API due to parallel processing and fewer network round-trips. This option is only available if the Use Bulk API option is selected. the value specified here is used. This option is selected by default and has no effect in versions 14. update.. The Bulk API is optimized to load or delete a large number of records asynchronously. is disabled by default and must be enabled by an administrator. Upload Bulk API Batch as Zip File (enable to upload binary attachments) Select this option to use the Bulk API to upload zip files containing binary attachments. the load operation fails for the row if a value is specified that is too large for the field. they become immediately eligible for deletion. the load may fail. the deleted records are not stored in the Recycle Bin.

The name of the Windows domain used for NTLM authentication. you can use this setting to begin where the last successful operation finished. Start at row 4. see Configuring the Data Loader on page 4 The following settings are not available on the Settings ➤ Settings page in Data Loader when the Use Bulk API option is selected: Insert Null Values This option enables Data Loader to insert blank mapped values as null values during data operations when the Bulk API is disabled. if applicable. Empty field values are ignored when you update records using the Bulk API. use a field value of #N/A. The username for proxy server authentication. and Developer Editions Enabling the Bulk API in Data Loader allows you to load or delete a large number of records faster than using the default SOAP-based API. To set a field value to null when the Use Bulk API option is selected. Data Loader Behavior with Bulk API Enabled Available in: Enterprise. Unlimited. For more information. 7 . Allow field truncation This option directs Data Loader to truncate data for certain field types when the Bulk API is disabled.Installing and Configuring the Data Loader Configuring the Data Loader Field Description America/Los_Angeles. there are some differences in behavior in Data Loader when you enable the Bulk API. One important difference is that it allows you execute a hard delete if you have the administrative permission and license. The password for proxy server authentication. The proxy server port. A load operation fails for the row if a value is specified that is too large for the field when the Use Bulk API option is selected. Proxy Host Proxy Port Proxy Username Proxy Password Proxy NTLM domain The host name of the proxy server. If your last operation failed. Click OK to save your settings. or a custom ID such as GMT-8:00. However.

When this is severe. Using serial mode guarantees that batches are processed one at a time. 4. 3. 2. Note that using this option may significantly increase the processing time for a load. The uninstaller removes the program from your computer. Click OK. Uninstalling the Data Loader Available in: Enterprise. Click Remove. upserting. the load may fail.Installing and Configuring the Data Loader Uninstalling the Data Loader Configuring the Data Loader to Use the Bulk API Available in: Enterprise. Start the Data Loader by choosing Start ➤ Programs ➤ salesforce. Unlimited. and Developer Editions To uninstall the Data Loader client application: 1. Processing in parallel can cause database contention. and Developer Editions The Bulk API is optimized to load or delete a large number of records asynchronously. 2. deleting. they become immediately eligible for deletion. By default. Instead. Caution: When you select the Hard Delete operation. To configure Data Loader to use the Bulk API for inserting. the deleted records are not stored in the Recycle Bin. Go to Start ➤ Control Panel ➤ Add or Remove Programs. 8 .com ➤ Data Loader ➤ Data Loader. It is faster than the SOAP-based API due to parallel processing and fewer network round-trips. Choose Settings ➤ Settings. A Salesforce user license is required for hard delete. is disabled by default and must be enabled by an administrator. Note: You can also select the Enable serial mode for Bulk API option. Bulk API Hard Delete. Select the Use Bulk API option. Select the Data Loader program. and hard deleting records: 1. updating. 3. The administrative permission for this operation. Unlimited. Data Loader uses the SOAP-based API to process records.

“1” False values (case insensitive) = “no”. Unlimited. and Developer Editions Data Loader supports the following data types: Base64 String path to file (converts the file to a base64–encoded array).SSS-800 yyyy-MM-dd'T'HH:mm:ss 9 .SSS -800 yyyy-MM-dd'T'HH:mm:ss. Base64 fields are only used to insert or update attachments and Salesforce CRM Content.SSS'Z' yyyy-MM-dd'T'HH:mm:ss. “false”. “y”. “0” Date Formats We recommend you specify dates in the format yyyy-MM-ddTHH:mm:ss.SSSPST yyyy-MM-dd'T'HH:mm:ss. “n”. see Uploading Attachments on page 15 and Uploading Content with the Data Loader on page 16.SSS PST yyyy-MM-dd'T'HH:mm:ss.SSS+/-HHmm: • • • • • • • • yyyy is the four-digit year MM is the two-digit month (01-12) dd is the two-digit day (01-31) HH is the two-digit hour (00-23) mm is the two-digit minute (00-59) ss is the two-digit seconds (00-59) SSS is the three-digit milliseconds (000-999) +/-HHmm is the Zulu (UTC) time zone offset The following date formats are also supported: • • • • • • • • • • yyyy-MM-dd'T'HH:mm:ss.Using Data Loader Data Types Supported by the Data Loader USING DATA LOADER Data Types Supported by the Data Loader Available in: Enterprise.SSSPacific Standard Time yyyy-MM-dd'T'HH:mm:ss. “on”.SSS Pacific Standard Time yyyy-MM-dd'T'HH:mm:ss. Boolean • • True values (case insensitive) = “yes”.SSS GMT-08:00 yyyy-MM-dd'T'HH:mm:ss. “off ”. “true”. For more information.SSSGMT-08:00 yyyy-MM-dd'T'HH:mm:ss.

the earliest valid date is 1699-12-31T16:00:00.Using Data Loader Data Types Supported by the Data Loader • • • • • yyyy-MM-dd HH:mm:ss yyyyMMdd'T'HH:mm:ss yyyy-MM-dd MM/dd/yyyy HH:mm:ss MM/dd/yyyy Note the following tips for date formats: • • To enable date formats that begin with the day rather than the month. The earliest valid date is 1700-01-01T00:00:00Z GMT. make sure that all Salesforce IDs you enter in the Data Loader are in the correct case. European date formats aredd/MM/yyyy and dd/MM/yyyy HH:mm:ss. The latest valid date is 4000-12-31T00:00:00Z GMT. select the Use European date format box in the Settings dialog. invalid XML characters are removed. A knowledge base solution for this issue is available in the Salesforce Help & Training window. • Double Standard double string ID A Salesforce ID is a case-sensitive 15-character or case–insensitive 18-character alphanumeric string that uniquely identifies a particular record. Integer Standard integer string String All valid XML strings. 1700. 10 . in the Pacific timezone. 4000. we recommend that you change your computer setting to GMT in order to avoid date adjustments when inserting or updating records. or 4:00 PM on December 31. or just after midnight on January 1. Note: These values are offset by your timezone. Tip: To ensure data quality. 1699. If your computer's locale is east of Greenwich Mean Time (GMT).” Only dates within a certain range are valid. search for “data loader date. or just after midnight on December 31. For example.

Choose the fields you want to export. 6. select the Account object. 7. check Id and Name in the query fields and click Finish. SOQL allows you to specify the source object (such as account). click Next. Similar to the SELECT command in SQL. you will not be asked to log in again. or click No to choose another file. For example. a. to select the CSV file to which the data will be exported. If your object name does not display in the default list. c. Click Export or Export All . Product2Id. For object descriptions. 5. check Show all objects to see a complete list of objects that you can access. If you select an existing file. Optionally.ProductCode FROM PricebookEntry WHERE IsActive = true 11 . Salesforce automatically sends you an activation email that you can use to log in. After your login completes successfully. 2. Click Yes to confirm this action. Review the generated query and edit if necessary. Pricebook2Id. you must enter mypasswordXXXXXXXXXX to log in. if your password is mypassword.. select conditions to filter your data set.. 4. b. all the data to which you have read access will be returned. If you do not select any conditions. Click Browse. Click Log in to log in. and Developer Editions User Permissions Needed To export records: To export all records: “Read” on the records “Read” on the records You can use the Data Loader export wizard to extract data from any Salesforce object. Enter your Salesforce username and password.Using Data Loader Exporting Data Exporting Data Available in: Enterprise. with developer name noted in parentheses. the contents of that file are replaced. Choose an object. The email contains a security token that you must add to the end of your password. You can enter a new file name to create a new file or choose an existing file. and conditions for selecting rows in the source object. For example. These commands can also be found in the File menu. 3. When you export. and your security token is XXXXXXXXXX. you will see that the CSV viewer displays all the Account names and their IDs. a list of fields to retrieve.com ➤ Data Loader ➤ Data Loader. 1. Create a SOQL query for the data export. Start the Data Loader by choosing Start ➤ Programs ➤ salesforce.Name. As you follow the next steps. logins from untrusted IPs are blocked until they're activated. (Until you log out or close the program. Click Next. Pricebook2. see the Web Services API Developer's Guide.) If your organization restricts IP addresses. For example. SOQL is the Salesforce Object Query Language that allows you to construct simple but powerful query strings. you can choose to include (Export All) or exclude (Export) soft-deleted records. For example: Select Name. Unlimited. Tip: You can use a SOQL relationship query to include fields from a related object. Product2. The objects will be listed by localized label name.

The Data Loader does not support nested queries or querying child objects.Name does not work.Name. if you are inserting new Account records where your CSV file contains the names of new accounts. a confirmation window summarizes your results. click and drag the Name field to the right of the NAME column header field.Name FROM Contact When using relationship queries in the Data Loader. As a workaround. the fully specified field names are case-sensitive. 10. After the operation completes. see Reviewing Output Files on page 17. A progress information window reports the status of the operation. automatic matching works only on the ID field. click Auto-Match Fields to Columns. use the Mapping Dialog window to associate Salesforce fields with the columns of your CSV file. 2. or click OK to close. PricebookEntry. Account. For example. Unlimited. For example. Optionally. Click OK to use your mapping for the current operation. or update files. 1. see the Web Services API Developer's Guide. or Deleting Data Using the Data Loader on page 13. To manually match fields with columns.Family FROM OpportunityLineItems) FROM Opportunity For more information on SOQL. LastName. click Save Mapping to save this mapping for future use. Click Finish. delete. ListPrice. queries similar to the following return an error: SELECT Amount. To automatically match fields with columns. 9. Note: The Data Loader currently does not support the extraction of attachments. we recommend that you use the weekly export feature in the online application to export attachments. Name. using ACCOUNT. Click Yes to confirm this action. PricebookEntry. For example. 4.UnitPrice. Defining Field Mappings Available in: Enterprise. 8.product2. Note that for a delete operation. For more details. see Inserting. click and drag fields from the list of Salesforce fields at the top to the list of CSV column header names at the bottom. the contents of that file are replaced. Id. PriceBookEntry.Using Data Loader Defining Field Mappings Or: Select Id. (SELECT Quantity. Specify a name for the SDL mapping file. Click View Extraction to view the CSV file. and Developer Editions Whenever you insert. 12 . For more information. The Data Loader automatically populates the list at the bottom of the window. If you select an existing file. based on the similarity of field and column names. then click Yes to confirm. 3. Updating. or click No to choose another file.NAME instead of Account.

if you are inserting Account records. to insert new Account records. If the object has no external ID fields. and your security token is XXXXXXXXXX. Start the Data Loader by choosing Start ➤ Programs ➤ salesforce. Click Log in to log in. After the object and CSV file are initialized. select which field to use for matching. Enter your Salesforce username and password. click Next. Salesforce automatically sends you an activation email that you can use to log in. 5. 1. the deleted records are not stored in the Recycle Bin and become immediately eligible for deletion. if your password is mypassword. If no match is found. the existing record is updated with the values in your file. logins from untrusted IPs are blocked until they're activated.. The column may be either an external ID (a custom field with the “External ID” attribute). For example. Delete or Hard Delete. 2. or Deleting Data Using the Data Loader Inserting. and hard delete wizards in the Data Loader allow you to add new records. If your object name does not display in the default list. For object descriptions. Click Next to continue. For more information. Upsert. to select your CSV file. If you are performing an upsert: a. Click Next.com ➤ Data Loader ➤ Data Loader. The objects are listed by localized label name. if you are inserting Account records. you must enter mypasswordXXXXXXXXXX to log in. you could specify a CSV file named insertaccounts. Id is automatically used. Your CSV file must contain a column of ID values for matching against existing records. click OK. For example. see “Custom Field Attributes” in the Salesforce online help. select Account. From the drop-down list. Update. upsert. When you hard delete records. After your login completes successfully. modify existing records.csv containing a Name column for the names of the new accounts. These commands can also be found in the File menu.) If your organization restricts IP addresses. check Show all objects to see a complete list of the objects that you can access. Choose an object. see the Web Services API Developer's Guide. update. 6.if a record in your file matches an existing record. Click Browse. Unlimited. Updating. 3. or Id (the Salesforce record ID). Click Insert. The email contains a security token that you must add to the end of your password. then the record is created as new. 7. For more information on external IDs. (Until you log out or close the program. you are not asked to log in again. or Deleting Data Using the Data Loader Available in: Enterprise. and Developer Editions User Permissions Needed To insert records: To update records: To upsert records: To delete records: To hard delete records “Create” on the record “Edit” on the record “Create” or “Edit” on the record “Delete” on the record “Delete” on the record The insert. Updating. 13 . 4. Note that “upsert” is a combination of inserting and updating . For example. delete. see Configuring the Data Loader on page 4..Using Data Loader Inserting. or delete existing records. begin by clicking Insert. with developer name noted in parentheses. For example.

. save an extra copy of the generated CSV file. and then click Yes to confirm. split your file into smaller files. or Deleting Data Using the Data Loader b. If the Bulk API continues to exceed the 10-minute limit on subsequent attempts. If your file includes the external IDs of an object that has a relationship to your chosen object. we recommend the following steps: 1. Note that matching is done according to record ID. see Reviewing Output Files on page 17. a confirmation window summarizes your results. review your success and error log files. 12. or “Running Reports” in the Salesforce online help. 4. you can use the related object's Id field for matching by mapping it in the next step. review Performing Mass Updates and Performing Mass Deletes for tips and best practices. some records could have completed successfully. Also. If you make no selection here. Click View Successes to view your success file. Click Choose an Existing Map to select an existing field mapping. 6. and try again. As a backup measure. Click Next. Click Finish to perform the operation. Define how the columns in your CSV file map to Salesforce fields.” while the other starts with “error. 2. See Inserting. or by running a report. 8. the file is placed back in the queue and reprocessed up to 10 times before the operation is permanently marked as failed. see Defining Field Mappings on page 12. and update your data. Tip: • • If you are updating or deleting large amounts of data. There is a five-minute limit to process 100 records when the Bulk API is enabled. a progress information window reports the status of the data movement. For more details and an example of usage. use the backup file to update the records to their previous values. 10.. 3. the Bulk API places the remainder of the file back in the queue for later processing. Open your working file in a CSV editor such as Excel. For more information. to specify a directory for these files. Updating. Obtain your data by performing an export of the objects you wish to update. 5. After the operation. click View Errors to open your errors file.Using Data Loader Inserting. and Developer Editions To update a large number of records at one time. As the operation proceeds. See Reviewing Output Files on page 17. Performing Mass Updates Available in: Enterprise. 11. enable that external ID for record matching by selecting its name from the drop-down list. Launch the Data Loader and follow the update wizard. If you get a timeout error when loading a file.” Click Browse. one file name starts with “success. Even if the processing failed. Unlimited. Make sure your report includes the record ID. 9. or click OK to close. For every operation. 14 . 13. or click Create or Edit a Map to create a new map or modify an existing map. Updating. if it takes longer than 10 minutes to process a file. Click Next to continue. After the operation completes. If you made a mistake. the Data Loader generates two unique CSV log files. See Exporting Data on page 11. so you must check the results. or Deleting Data Using the Data Loader on page 13.

see Inserting.doc The CSV file can also include other optional Attachment fields. Updating.) Save an extra copy of the generated CSV file. For example. 3. Proceed with an insert or upsert operation. begin by requesting a weekly data export for the source organization. Ensure that the values in the Body column contain the full file name of the attachments as they exist on your computer.gif 701300000000iNHAAY. Launch the Data Loader and follow the delete or hard delete wizard. Next. such as Description. we recommend the following steps: 1. such as myattachment. Unlimited.doc. which causes the file Attachment. Name .. If you are migrating attachments from a source Salesforce organization to a target Salesforce organization.C:\Export\files\attachment2. Body . Updating. See Inserting. export the objects you wish to delete.Body 50030000000VDowAAG. At the Select data objects step. Uploading Attachments You can use the Data Loader to upload attachments to Salesforce. You can use this CSV file to upload the attachments. this time using only the record ID as the desired criteria. Before uploading attachments. and Developer Editions To delete a large number of records at one time using the Data Loader.Name.jpg is located on your computer at C:\Export. Confirm that the CSV file you intend to use for attachment importing contains the following required columns (each column represents a Salesforce field): • • • ParentId . Your CSV file might look like this: ParentId. 15 . or Deleting Data Using the Data Loader on page 13. 2.csv to be included in your export.jpg.Using Data Loader Uploading Attachments Performing Mass Deletes Available in: Enterprise. see “Exporting Backup Data” in the Salesforce online help. (See Exporting Data on page 11. checkbox.the absolute path to the attachment on your local drive.the name of the attachment file. make sure to select the Show all Salesforce objects checkbox and the Attachment object name in the list. review your success and error log files.jpg.the Salesforce ID of the parent record. export the objects you wish to delete. Body must specify C:\Export\myattachment.attachment1. See Reviewing Output Files on page 17. being sure to select all fields.attachment2. make sure to select the Include Attachments. if an attachment named myattachment. Map only the ID column.jpg. or Deleting Data Using the Data Loader on page 13. verify that Upload Bulk API Batch as Zip File (enable to upload binary attachments) on the Settings ➤ Settings page is enabled. To upload attachments: 1. As a backup measure. After the operation. note the following: • • If you intend to upload via the Bulk API.. For more information on the weekly export service.C:\Export\attachment1. On the Schedule Export page. 2. 4.

workspace ID. To determine the RecordTypeId values for your organization using the Data Loader. This adds approximately 30% to the file size. FirstPublishLocationId . Name FROM RecordType WHERE SobjectType = 'ContentVersion' To determine the RecordTypeId values for your organization using the AJAX Toolkit: a. Description . and Developer Editions You can use the Data Loader to bulk upload documents and links into workspaces in Salesforce CRM Content. • VersionData . note the following: • • If you intend to upload via the Bulk API. 16 . Your SOQL query might look like this: Select Id. VersionData identifies the location and extracts the format and PathOnClient identifies the type of document being uploaded.file name. • • • • • PathOnClient . you must specify RecordTypeId. Unlimited. Before uploading documents or links.content type ID. you must specify the actual path in the VersionData and PathOnClient fields in the CSV file. You can't export content using the Data Loader.complete file path on your local drive (for uploading documents only). use double quotes around the text.Using Data Loader Uploading Content with the Data Loader Uploading Content with the Data Loader Available in: Enterprise. • • 1. When you upload a link using the Data Loader. OwnerId . Note: If you publish to a workspace that has restricted content types.complete file path on your local drive (for uploading documents only).(optional) file or link description. defaults to the user uploading the file. follow the steps in Exporting Data. Do not use PathOnClient or VersionData to upload links. verify that Upload Bulk API Batch as Zip File (enable to upload binary attachments) on the Settings ➤ Settings page is enabled. you must specify the URL in ContentUrl.URL (for uploading links only). Log in to Salesforce.(optional) file owner. Note: If there are commas in the description. ContentUrl . Create a CSV file with the following fields: • • Title . Note: Files are converted to base64 encoding on upload. RecordTypeId . When you upload a document from your local drive using the Data Loader.

Click on the arrows for recordTypeInfos.(optional) tag. The “error” file contains all records that were rejected from the load operation.com/soap/ajax/21.salesforce. select the Generate success files for exports setting. For more information.” while the other starts with “error. and then click OK to exit the window. To view the last error file. Enter the instanceName. You can see the instanceName in the URL field of your browser after logging in to Salesforce.describeSObject("ContentVersion") d. One file name starts with “success. 2. Unlimited. the Data Loader generates two unique CSV output files. In it. All documents and links will be available in the specified workspace. click Open Error. • TagsCsv . such as na1.pdf. such as Microsoft® Office Excel. Note: To generate success files when exporting data. use for bulk upload".c:\files\testfile. click Open CSV. see Inserting. The Data Loader has a built-in CSV file viewer with which you can open these files. there is a column for newly generated record IDs.one 2.” During every export.TagsCsv testfile. and Developer Editions After every import or export. In it. Click Close to return to the CSV Chooser window. Optionally."This is a test file. The default is 1000. Upload the CSV file for the ContentVersion object.012300000008o2sAQG. the Data Loader saves extracted data to a CSV file that you specify in the wizard. Specify a number of rows to view. click Open in External Program to open the file in the associated external program. for your organization.Using Data Loader Reviewing Output Files b. Press Enter.c:\files\testfile. 4.html. All of the RecordTypeId values for your organization are listed.RecordTypeId. there is a column that describes why the load failed.VersionData.connection. c. The CSV file opens in a new window.PathOnClient.FirstPublishLocationId. see Configuring the Data Loader on page 4. click Open Success.OwnerId. To view the last success file. Enter this URL in your browser: http://instanceName. A sample CSV file is: Title. 5.0/debugshell.005000000000000. e.pdf. 17 . Choose View CSV from the View menu of the Data Loader. Reviewing Output Files Available in: Enterprise. The “success” file contains all records that were successfully loaded.Description.058700000004Cd0. or Deleting Data Using the Data Loader on page 13. Updating. To view output files from a Data Loader operation: 1. In the AJAX Toolkit Shell page type: sforce. Each row in the CSV file corresponds to one Salesforce record. 3. To view a CSV file of your choice.

For example.com Customer Support. and Developer Editions If you need to investigate a problem with the Data Loader. such as Microsoft Notepad. it includes log entries for the creation of proxy server network connections. you may need to obtain a new security token. ensure that the password provided in the configuration parameters is encrypted.log. You can quickly open these files by entering %TEMP%\sdl. See the following topics: • • • • • • • • • • • Understanding Installed Directories and Files Encrypting From the Command Line Upgrading Your Batch Mode Interface Using the Command Line Interface Configuring Batch Processes Data Loader Process Configuration Parameters Data Loader Command Line Operations Configuring Database Access Mapping Columns Running Individual Batch Processes Data Access Objects 18 . If you are having login issues from the UI. These files can be opened with commonly available text editor programs. Log entries marked “ERROR” are problems such as a submitted record missing a required field. If you are having login issues from the command line. RUNNING BATCH PROCESSES Running in Batch Mode You can run the Data Loader in batch mode from the command line. Log entries marked “INFO” are procedural items.log in either the Run dialog or the Windows Explorer address bar.log Contains a detailed chronological list of Data Loader log entries. you can access log files that track the operations and network connections made by the Data Loader.log and %TEMP%\sdl_out. Unlimited. such as logging in to Salesforce.Running Batch Processes Troubleshooting Data Loader Operations Troubleshooting Data Loader Operations Available in: Enterprise. The two log files are: sdl.log A supplemental log that contains additional information not captured in sdl. or if requested by salesforce. sdl_out.

installing the Data Loader creates several directories under the installation directory. Understanding Installed Directories and Files In versions 8.properties file that is generated when you modify the Settings dialog in the graphical user interface is located at C:\Documents and Settings\your Windows username\Application Data\salesforce. The following directories are involved in running the program from the command line for automated batch processing: bin Contains the batch files encrypt. If you installed the program to a different location. File Path Convention The file paths provided in these topics start one level below the installation directory. Encrypting From the Command Line When running the Data Loader in batch mode from the command line. follow the prompts provided to execute the following actions: 19 .Running Batch Processes Understanding Installed Directories and Files Note: If you have used the batch mode from the command line with a version earlier than 8. see Upgrading Your Batch Mode Interface on page 20. samples Contains subdirectories of sample files for reference. For example. You can copy this file to the conf installation directory to use it for batch processes. 2.bat.password sfdc.com\Data Loader version_number\bin.0 and later.proxyPassword Use the utility described below to perform encryption.xml. Using the Encryption Utility The Data Loader offers an encryption utility to secure passwords specified in configuration files. Run \bin\encrypt. At the command line. and log-conf.0.bat for running batch processes.bat for encrypting passwords and process. Contains the configuration files config. \bin means C:\Program Files \salesforce. For information on running the Data Loader from the command line. The config.properties. see Using the Command Line Interface on page 20.class. conf The default configuration directory. please substitute that directory path as appropriate. Loader. you must encrypt the following configuration parameters: • • sfdc.com\Data Loader version_number. To use the encryption utility: 1. provided you accepted the default installation directory.

For more information. Optionally. Unlimited. In the configuration file. Upgrading Your Batch Mode Interface The batch mode interface in versions 8.properties.bat. Before running any batch operation. For more information about using process. add -help to the command contained in process. see Running Individual Batch Processes on page 35.properties file was created manually. see Running in Batch Mode on page 18. Optionally. omitting any leading or trailing spaces. Continue to use that version for batch processes. see Understanding Installed Directories and Files on page 19. Using the Command Line Interface Available in: Enterprise.properties file from the graphical user interface. Use this new file with the new batch mode interface.0 to run batch processes. verifies whether the encrypted password provided matches its decrypted version. The key file can then be used for encryption and decryption. Encrypt text Generates an encrypted version of a password or other text. install the new version alongside the old version and dedicate the old version solely to batch processes. The name of the batch process bean contained in process-conf. navigate into the bin directory and type process.properties file If your old config. To view tips and instructions. be sure to include your encrypted password in the configuration file. Manually update your config. You cannot take advantage of newer features such as database connectivity. Generate a new config. For more information. your options are as follows: Maintain the old version for batch use Do not uninstall your old version of the Data Loader. use the new version to set the same properties and generate a new file. If you are using a version earlier than 8.bat. but your integrations will continue to work. Verify encrypted text Given encrypted and decrypted versions of a password. you can provide a key file for the encryption.bat. run Data Loader from the command line. make sure that the encrypted text is copied precisely and the key file is mentioned. then you must manually update it for the new version.0 and later of the Data Loader are not backwards-compatible with earlier versions.properties file from the new GUI If you originally generated your config. Carefully copy the key text to a key file. which takes the following parameters: • • The directory containing config. and Developer Editions For automated batch operations such as nightly scheduled loads and extractions. For more information. A success or failure message is printed to the command line.xml. 20 . From the command line.Running Batch Processes Upgrading Your Batch Mode Interface Generate a key Key text is generated onscreen from the text you provide. see Encrypting From the Command Line on page 19.

Data Loader configuration files are installed at the following location: C:\Program Files\salesforce.properties. A process should have ProcessRunner as the class attribute and the following properties set in the configuration file: name Sets the name of the ProcessRunner bean. lastRunOutputDirectory The directory location where output files containing information about the last run. output files containing information about the last run. 21 .html Tip: If you experience login issues in the command line interface after upgrading to a new version of the Data Loader. If set to false. are written. such as sendAccountsFile_lastrun. You can set the minimum and maximum heap size.Running Batch Processes Configuring Batch Processes The Data Loader runs whatever operation. For example. The default value is \conf. setting process. or map is specified in the configuration file that you specify. Otherwise. adding process. the value is the setting value.properties.xml.0 and later. are generated and saved to the location specified by lastRunOutputDirectory. For example. By default. file. use a copy of log-conf. For more information on batch mode. the files are not generated or saved. configOverrideMap A property of type map where each entry represents a configuration setting: the key is the setting name. such as sendAccountsFile_lastrun. If you use process-conf. Configuring Batch Processes Use \samples\conf\process-conf. If you want to implement enhanced logging. please try re-encrypting your password to solve the problem. see Encrypting From the Command Line on page 19.operation=insert to the command changes the configuration at runtime. see the following blog post for command line instructions: http://blog.xml.properties file is used for parameter settings. If you do not specify a configuration directory. this value is not used because the files are not generated. the config.com/sforce/2005/06/sforce_data_loa. enableLastRunOutput If set to true (the default).com\Data Loader version number\conf The batch process configuration file is process-conf.sforce. see Running in Batch Mode on page 18. -Xms256m -Xmx256m sets the heap size to 256 MB.name to the name of a process specifies a process to run. For information on the password encryption utility.xml.xml to configure your Data Loader processes. Note: These topics only apply to version 8. the current directory is used. You can change parameters at runtime by giving param=value as program arguments. If you have an earlier version of the Data Loader. If enableLastRunOutput is set to false. This value is also used as the non-generic thread name and for configuration backing files (see below). which are represented by ProcessRunner beans.

Note the implication for a large parameter value: if an error occurs. In some cases. The settings in configOverrideMap take precedence over those in the configuration backing file. and databaseRead. all records in dataAccess.properties.properties. Standard types are csvWriter. The maximum value is 2. The configuration backing file is managed programmatically and does not require any manual edits.readUTF8 boolean dataAccess. UTF-8 encoding Sample value: true Write all This option forces files to be written in UTF-8 CSVs with encoding.xml. csvRead. the option is also represented in the graphical user interface at Settings ➤ Settings.writeUTF8 boolean dataAccess. see Data Loader Process Configuration Parameters on page 22.Running Batch Processes Data Loader Process Configuration Parameters The configuration backing file stores configuration parameter values from the last run for debugging purposes.000. dataAccess. UTF-8 encoding Sample value: true dataAccess. Data Loader Process Configuration Parameters When running the Data Loader in batch mode from the command line. and is used to load default configuration parameters in config. The maximum value is 200. Parameter Name Data Type Equivalent Option in Settings Dialog Description This option forces files to open in UTF-8 Read all encoding. such as a CSV file name. databaseWrite. even if they were saved in a different CSVs with format.name string Not applicable (N/A) Name of the data source to use.csv Number of records read from your back-end or other external database at a time. For databases.readBatchSize integer N/A Sample value: 50 Standard or custom data source type. use the name of the database configuration in database-conf.type string N/A Sample value: csvWrite Number of records written to your back-end or other external database at a time. you can specify the following configuration parameters in config.writeBatchSize integer N/A 22 . For the names and descriptions of available process configuration parameters. Sample value: c:\dataloader\data\extractLead. dataAccess.

Sample value: 500 Generate Select this option to generate a success file when success exporting data. you can disable the generation of output files such as sendAccountsFile_lastRun.enableLastRunOutput boolean N/A Sample value: true Name of the file that contains the encryption key. process.lastRunOutputDirectory string (directory) N/A 23 .key The initial setting for the process. each record is processed individually (not in batch) and errors are specific to a given record. you can change the location where output files such as process. Format must be yyyy-MM-ddTHH:mm:ss. For an explanation of the date format syntax.properties.Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Description the batch are rolled back. We recommend setting the value to 1 when you need to diagnose problems with writing to a database. which can be used in a SQL string and is automatically updated when a process has run successfully. Files of this type are saved by default to the conf directory. Alternatively. you can change the location of the directory where these files are saved.enableExtractSuccessOutput boolean When running the Data Loader in batch mode.lastRunDate parameter.initialLastRunDate date N/A example: 2006-04-13T13:50:32.lastRunOutputDirectory. See Encrypting From the Command Line on page 19. To stop the writing of these files. using process.SSS+/-HHmm.423-0700 When running the Data Loader in batch mode.encryptionKeyFile string (file name) N/A Sample value: c:\dataloader\conf\my. see Date Formats on page 9. if the value is set to 1. In contrast. For process. files for Sample value: true exports process. set this option to false. process.

you can stop the files from being written.csv 24 . See Mapping Columns on page 34. See also process. change the value of this option to the full path where the last run files should be written.enableLastRunOutput. Sample value: process.properties are written.sdl The operation to perform. To change the location. you can use this setting to begin where the last successful operation finished.outputSuccess string (file name) on page 23. Sample value: N/A c:\dataloader\status\myProcessSuccesses.operation string N/A Sample value: extract The directory where “success” and “error” output files are saved.mappingFile string (file name) N/A c:\dataloader\conf\accountExtractMap.csv The name of the CSV file that stores success data from the last operation.Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Description sendAccountsFile_lastRun.xml. Sample value: c:\dataloader\status The name of the CSV file that stores error data from the last operation.enableExtractSuccessOutput process. If your last operation failed. See Data Loader Command Line Operations on page 30. Files of this type are saved by default to the conf directory. using process. The file names are automatically generated for each operation unless you specify otherwise in process-conf. Sample value: process. process. Alternatively.outputError string (file name) N/A c:\dataloader\status\myProcessErrors.statusOutputDirectory string (directory) N/A process. process.loadRowToStartAt number Start at row Sample value: 1008 Name of the the field mapping file to use.

and upserts on cases and leads. See also sfdc. process.useBulkApi.useEuropeanDates boolean sfdc. Sample value: true Specify the ID of the assignment rule to use for inserts. sfdc.useBulkApi. This option applies to inserts. See also sfdc. updates. sfdc. When this is severe. It also applies to updates on accounts if your organization has territory assignment rules on accounts.Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Use European Date Format Description Select this option to support the date formats dd/MM/yyyy and dd/MM/yyyy HH:mm:ss. updates. and upserts. Sample value: false sfdc.useBulkApi. Using serial mode guarantees that batches are processed one at a time. the load may fail. Sample value: true The number of seconds to wait for a connection during API calls. Note that using this option may significantly increase the processing time for a load.assignmentRule string Assignment Sample value: 03Mc00000026J7w Rule The number of milliseconds to wait between successive checks to determine if the asynchronous Bulk API operation is complete or how many records have been processed.bulkApiCheckStatusInterval integer N/A Sample value: 5000 Select this option to use serial instead of parallel processing for the Bulk API. such as Attachment records or Salesforce CRM Content. The assignment rule overrides Owner values in your CSV file. See also sfdc. We recommend a value of 5000.connectionTimeoutSecs integer N/A Sample value: 60 25 . Processing in parallel can cause database contention.bulkApiZipContent boolean sfdc.bulkApiSerialMode boolean Enable serial mode for Bulk API Upload Bulk API Batch as Zip File (enable to upload binary attachments) Select this option to use the Bulk API to upload zip files containing binary attachments.

Stores SOAP messages sent to or from Salesforce.com.minRetrySleepSecs on page 27. sfdc.000. specifies the custom field with the “External ID” attribute that are used as a unique identifier for data matching.debugMessages boolean N/A Sample value: false See process. See sfdc. please monitor your available disk storage appropriately.enableExtractSuccessOutput sfdc. As the file does not have a size limit.enableRetries boolean N/A Sample value: true Enter the URL of the Salesforce server with which you want to communicate. For example.log If true.externalIdField string N/A Query Request Size Sample value: LegacySKU__c In a single export or query operation.salesforce. The maximum value is 2.Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Description If true.entity string N/A Sample value: Lead Used in upsert operations. sfdc.extractionRequestSize integer 26 .endpoint URL Server Host Sample production value: https://login. if you are loading into a sandbox. enables repeated attempts to connect to Salesforce servers.debugMessagesFile string (file name) on page 23.com/services/Soap/u/21. enables SOAP message debugging.maxRetries on page 27 and sfdc. Sample value: N/A \lexiloader\status\sfdcSoapTrace.debugMessagesFile. Larger values sfdc. they are appended to the end of the file. sfdc. sfdc.0 The Salesforce object used in the operation. records are returned from Salesforce in increments of this size. By default. see “Custom Field Attributes” in the Salesforce online help. sfdc.salesforce. For more information about external IDs. change the URL to https://test. messages are sent to STDOUT unless you specify an alternate location in sfdc. As messages are sent or received.

LastName. OwnerId FROM Lead string N/A sfdc.extractionSOQL FirstName.maxRetries integer N/A Sample value: 3 The minimum number of seconds to wait between connection retries. Note that when you are updating records.loadBatchSize integer Batch Size Sample value: 100 The maximum number of repeated attempts to connect to Salesforce. sfdc. sfdc. but use more memory on the client. See sfdc. To turn off compression. sfdc. upsert. See sfdc.enableRetries on page 26. this option instructs the Data Loader to overwrite any existing data in mapped fields. The maximum value is 200.insertNulls boolean Insert Null Values Enable this option to insert blank mapped values as null values during data operations. The wait time increases with each try. enable this option. or delete operation. AnnualRevenue. sfdc.enableRetries on page 26. Sample value: 500 The SOQL query for the data export. Sample value: SELECT Id. We recommend a value between 50 and 100. You may want to disable compression if you need to debug the underlying SOAP messages.noCompression boolean Compression Sample value: false 27 .Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Description may improve performance.minRetrySleepSecs integer N/A Sample value: 2 Compression enhances the performance of the Data Loader and is turned on by default. For more information on SOQL. sfdc. see the Web Services API Developer's Guide. records moving to or from Salesforce are processed in increments of this size. Rating. update. Sample value: false In a single insert.

proxyPort integer Sample value: 8000 The username for proxy server authentication. sfdc. Sample value: 4285b36161c65a22 The host name of the proxy server.Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Description sfdc. the time zone of the computer where Data Loader is installed is used. Salesforce resets the URL after login to the one specified in sfdc. sfdc. sfdc. See also Encrypting From the Command Line on page 19. if applicable.endpoint. sfdc.proxyHost URL Proxy Host Sample value: http://myproxy.proxyPassword encrypted Proxy string Password Proxy Port Proxy Username An encrypted password that corresponds to the proxy username provided in sfdc.com sfdc.internal.password encrypted string N/A An encrypted Salesforce password that corresponds to the username provided in sfdc.proxyUsername string Sample value: jane.timeZone string Time zone 28 .timeoutSecs integer Timeout Sample value: 540 If a date value does not include a time zone.To turn off this automatic reset. Sample value: 4285b36161c65a22 The proxy server port.resetUrlOnLogin boolean Reset URL on Login Sample value: false Specify how many seconds the Data Loader waits to receive a response back from the server before returning an error for the request. See also Encrypting From the Command Line on page 19. disable this option. sfdc.doe By default.username on page 30.company. • If no value is specified.proxyUsername on page 28. the value specified here is used. sfdc.

truncation.getDefault() method in Java.Running Batch Processes Data Loader Process Configuration Parameters Parameter Name Data Type Equivalent Option in Settings Dialog Description • If an incorrect value is entered.0 and earlier.0 and later. You can retrieve the default value by running the TimeZone. values for fields of those types are truncated by the Data Loader if they are too large. In Data Loader versions 14.0 and later. Phone. This option is not available if the Use Bulk API option is selected. delete. Text.String) method. or a custom ID such as GMT-8:00. update. and Text (Encrypted). The value can be a full name such as America/Los_Angeles.bulkApiSerialMode. and hard delete records. sfdc. Selecting this option allows you to specify that the previous behavior.truncateFields boolean Allow field truncation Sample value: true sfdc. the load operation fails for the row if a value is specified that is too large for the field. Valid values are any time zone identifier which can be passed to the Java getTimeZone(java.useBulkApi boolean Use Bulk API Select this option to use the Bulk API to insert.lang. 29 . Multi-select Picklist. upsert. GMT is used as the time zone and this fact is noted in the Data Loader log. In that case. Picklist. In Data Loader version 15. the load operation fails if a value is specified that is too large. This option is selected by default and has no effect in versions 14. Select this option to direct the Data Loader to truncate data in the following types of fields when loading that data into Salesforce: Email. It is faster than the default SOAP-based API due to parallel processing and fewer network round-trips. be used instead of the new behavior in Data Loader versions 15. The Bulk API is optimized to load or delete a large number of records asynchronously.0 and earlier. See also sfdc. This value is the time zone on the computer where Data Loader is installed.

several operations are supported. where existing records with matching ID fields are deleted without being stored first in the Recycle Bin. Extract Uses a Salesforce Object Query Language (SOQL) string to export a set of records from Salesforce.username string N/A Sample value: jdoe@mycompany.com Data Loader Command Line Operations When running the Data Loader in batch mode from the command line. See the following list of operation names and descriptions. then writes the exported data to a data source. where existing records with matching ID fields are updated. records without matches are inserted as new records. which you use to extract data directly from a database.password on page 28. where existing records with a matching custom external ID field are updated. Configuring Database Access When you run the Data Loader in batch mode from the command line. Delete Loads data from a data source into Salesforce.xml to configure database access objects. An operation represents the flow of data between Salesforce and an external data source such as a CSV file or a database. use \samples\conf\database-conf. Insert Loads data from a data source into Salesforce as new records. Update Loads data from a data source into Salesforce.Running Batch Processes Data Loader Command Line Operations Parameter Name Data Type Equivalent Option in Settings Dialog Description Sample value: true Salesforce username. 30 . Soft-deleted records are not included. including both existing and soft-deleted records. Extract All Uses a Salesforce Object Query Language (SOQL) string to export a set of records from Salesforce. Hard Delete Loads data from a data source into Salesforce. sfdc. where existing records with matching ID fields are deleted. then writes the exported data to a data source. Upsert Loads data from a data source into Salesforce. See sfdc.

It must refer to an implementation of javax.apache.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@myserver.internal.dbcp.salesforce.BasicDataSource when database connections are pooled.BasicDataSource. dataSource The bean that acts as database driver and authenticator.DataSource such as org. username The username for logging in to the database.dbcp.apache.commons. password The password for logging in to the database.dbcp.sql.commons.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="oracle.DatabaseConfig" singleton="true"> <property name="sqlConfig" ref="accountInsertSql"/> </bean> DataSource The DataSource bean sets the physical information needed for database connections. use org. which has the following properties: sqlConfig The SQL configuration bean for the data access object that interacts with a database.apache. For example.jdbc. Depending on your implementation. DataSource Example <bean id="oracleRepDataSource" class="org.commons. DatabaseConfig Example <bean id="AccountInsert" class="com.Running Batch Processes Configuring Database Access DatabaseConfig Bean The top-level database configuration object is the DatabaseConfig bean.com:1521:TEST"/> <property name="username" value="test"/> <property name="password" value="test"/> </bean> 31 .dao.dataloader.database. url The string for physically connecting to the database.salesforce. It contains the following properties: driverClassName The fully qualified name of the implementation of a JDBC driver. additional information may be required.driver.

The bean must be of type com.database. see Configuring Database Access on page 30. Each bean represents an instance of an object. several data access objects are supported. see the official documentation and the support forums. A typical bean has the following attributes: id Uniquely identifies the bean to XmlBeanFactory.xml to configure database access. csvRead Allows the reading of a comma or tab-delimited file. For more information. databaseRead Allows the reading of a database. a write interface (DataWriter). For more information. As shown in the code samples below. databaseWrite Allows writing to a database.com cannot guarantee the availability or accuracy of external websites. The Spring Framework allows you to use XML files to configure beans. Data Access Objects When running the Data Loader in batch mode from the command line. which is an open source full-stack Java/J2EE application framework. queries and inserts are different but very similar. A header row is added to the top of the file based on the column list provided by the caller. Use database-conf. which is the class that gets objects from an XML configuration file. class Specifies the implementation class for the bean instance. or both. SQL Configuration When running the Data Loader in batch mode from the command line. the parameters correspond to each object's setter methods. See the following list of object names and descriptions. They can implement a read interface (DataReader).dataloader. csvWrite Allows writing to a comma or tab-delimited file. A data access object allows access to an external data source outside of Salesforce.xml to configure database access. the SqlConfig class contains configuration parameters for accessing specific data in the database. There should be a header row at the top of the file that describes each column. Use database-conf. 32 .salesforce.SqlConfig and have the following properties: sqlString The SQL code to be used by the data access object.Running Batch Processes Configuring Database Access Spring Framework Overview The Data Loader configuration files are based on the Spring Framework. see Configuring Database Access on page 30. For more information on the Spring Framework. Note that salesforce.dao.

Note that “java.LOCATION_ID = party_sites. concat (concat(parties.LOCATION_ID and (locs.PARTY_ID and parties. parties. see the official JDBC API documentation. accounts.hz_organization_profiles org.address2) billing_address.hz_cust_accounts accounts.last_update_date > @process.lastRunDate@ OR accounts.lastRunDate@.Running Batch Processes Configuring Database Access The SQL can contain replacement parameters that make the string dependent on configuration or operation variables. Each entry represents one replacement parameter: the key is the replacement parameter's name.PARTY_ID and party_sites.PARTY_ID = accounts. locs.sql.dao.hz_party_sites party_sites. locs. ar.address1.postal_code. ' '). parties. locs.dataloader. @process.PARTY_ID = org. ar.database.util.Date instead of java.sql” types are sometimes required.city.last_update_date > @process.state.salesforce.PARTY_ID and locs.organization_name. the value is the fully qualified Java type to be used when the parameter is set on the SQL statement.sic_code from ar.country. ar. such as java.lastRunDate@ </value> </property> <property name="columNames"> <list> <value>recordTypeId</value> <value>account_number</value> <value>organization_name</value> <value>billing_address</value> <value>city</value> <value>postal_code</value> <value>state</value> <value>country</value> <value>sic_code</value> </list> </property> <property name="sqlParams"> 33 . Contains column names for the data outputted by executing the SQL. Replacement parameters must be delimited on both sides by “@” characters.SqlConfig" singleton="true"> <property name="sqlString"/> <value> SELECT distinct '012x00000000Ij7' recordTypeId. For example.hz_parties parties.Date. For more information. locs. columnNames Used when queries (SELECT statements) return a JDBC ResultSet. org.account_number. SQL Query Bean Example <bean id="accountMasterSql" class="com.hz_locations locs where accounts. sqlParams A property of type map that contains descriptions of the replacement parameters specified in sqlString. ar.PARTY_ID = accounts. The column names are used to access and return the output to the caller of the DataReader interface.

Data sources can be either column names or constants.INT_PARTIES ( BILLING_ADDRESS. Destinations must be column names.mappingFile to specify the name of your mapping file. as in “sampleconstant”.salesforce. SIC_CODE) VALUES (@billing_address@.dao. SLA__C=SLA__c BILLINGCITY=BillingCity SYSTEMMODSTAMP= OWNERID=OwnerId CUSTOMERPRIORITY__C=CustomerPriority__c ANNUALREVENUE=AnnualRevenue DESCRIPTION=Description 34 . Observe the following syntax: • • • • • On each line.String"/> </map> </property> </bean> Mapping Columns When running the Data Loader in batch mode from the command line. In your configuration file. You may map constants by surrounding them with double quotation marks.Date"/> </map> </property> </bean> SQL Insert Bean Example <bean id="partiesInsertSql" class="com. and the destination on the right. Surround constants with double quotation marks. 2.dataloader. Create a new file.sql. you must create a properties file that maps values between Salesforce and data access objects. pair a data source with its destination. an equals sign (=) as a separator.Running Batch Processes Mapping Columns <map> <entry key="process. as in "United States"=BillingCountry.database. use the parameter process. Values without quotation marks are treated as column names.SqlConfig" singleton="true"> <property name="sqlString"/> <value> INSERT INTO REP.lastRunDate" value="java.String"/> <entry key="sic_code" value="java. Put the data source on the left. 3. Column Mapping Example for Data Insert The Salesforce fields are on the right.lang. @sic_code@) </value> </property> <property name="sqlParams"/> <map> <entry key="billing_address" value="java. 1.lang.

Process Example process .bat.xml. copy process-conf.org/licenses/LICENSE-1.1 35 . create a new directory and add the following files to it: • • • If your process is not interactive. Unlimited.apache.org/licenses/LICENSE-1. To use an alternate directory. and Developer Editions The following third-party licenses are included with the installation of the Data Loader: Technology Axis Ant Apache Jakarta Commons BeanUtils Version Number 1. which requires the following parameters: A configuration directory The default is \conf. If your process requires database connectivity. Id=account_number Name=name Phone=phone Running Individual Batch Processes To start an individual batch process use \bin\process.1 http://www. A process name The name of the ProcessRunner bean from \samples\conf\process-conf. copy database-conf.6 License http://www. Data Loader Third-Party Licenses Available in: Enterprise.Running Batch Processes Running Individual Batch Processes BILLINGSTREET=BillingStreet SHIPPINGSTATE=ShippingState Column Mapping Example for Data Export The Salesforce fields are on the left.xml from \samples\conf./conf accountMasterProcess Note: You can configure external process launchers such as the Microsoft Windows XP Scheduled Task Wizard to run processes on a schedule.xml from \samples\conf.. Copy config.properties from \conf.1 1.apache.

063 OpenSymphony Quartz Enterprise 1.org/commons/license.apache.com/quartz/license.mozilla.5.Running Batch Processes Data Loader Third-Party Licenses Technology Apache Commons Collections Apache Commons Database Connection Pooling (DBCP) Apache Commons Logging Version Number 3.1 Job Scheduler Rhino JavaScript for Java Spring Framework 1.8 3.apache.2 Library Apache Log4j Eclipse SWT 1.org/commons/license.1 1.org/licenses/LICENSE-2.opensymphony.org/MPL/MPL-1.txt http://www.2.0.eclipse.2.html http://jakarta.org/commons/license.2.html http://jakarta.0.html http://www.1 1. 36 .0.apache.html http://www.txt Apache Commons Object Pooling 1.com is not responsible for the availability or content of third-party websites.6 Note: salesforce.apache.org/org/documents/epl-v10.action http://www.org/licenses/LICENSE-2.apache.org/commons/license.6R2 1.apache.1.html http://www.3 License http://jakarta.html http://jakarta.

8 uploading attachments 15 D Data Loader attachments 8 batch files 19 batch mode 18 batch mode parameters 22 Bulk API 4. 7. 8. 8 Spring Framework 32 starting batch processes 35 system requirements 3 third-party licenses 35 troubleshooting 18 uninstalling 8 uploading 16 uploading attachments 15 using 7 when to use 2 B Bulk API 4.properties 22 configuring 4. 8 S Spring Framework. see Data Loader 32 37 . 16 column mapping 34 command line interface 20 command line operations 30 config.Index Index A Apex Data Loader See Data Loader 1 Data Loader (continued) configuring batch processes 21 data types 9 date formats 9 installed files 19 installing 3 overview 1 password encryption 19 sample files 19 settings 7.

Sign up to vote on this title
UsefulNot useful