New Batch#100 (10th Nov 2021) - Salesforce Admin + Dev Training (WhatsApp: +91 - 8087988044) :https://t.co/p4F3oeQagK

Showing posts with label Apex Data Loader. Show all posts
Showing posts with label Apex Data Loader. Show all posts

Saturday, 10 November 2012

Data Loader batch size

* If the batch size is 50 then if one of the record in those 50 records failed to insert due to error all remaining records in that batch also fail.
* If you try to insert those failed records again with batch size '1' then most of the records will get insert apart from those records which causing problem really.

Tuesday, 25 September 2012

Data Loader CLI

Data Loader CLI (Command Line Interpreter):
* For automating the batches and schedule them using windows "Task Scheduler".
* We can perform import as well as export.
Windows-7 Task Scheduler
* We can do all the same things from the command line - insert data, update data, upsert data, delete data or extract data.
* Instead of "export", we should use "extract".
* We can move data to and from a comma-separated variable file (.csv) or to and from a relational database, such as Oracle or SQL Server, that has a standard JDBC driver.
* With a default installation on a Windows machine, all the Data Loader files will be placed in the Program Files\salesforce.com\Apex Data Loader APIversion directory, where APIversion corresponds to the API version.
* The process command, encrypt command will be in the bin subdirectory, and the configuration files will normally be in the conf subdirectory.
*The main configuration file used by the CLI is the process-conf.xml file.
* The process-conf.xml file contains a description for every potential process that could be called from the command line.
* Each of these processes is referred to as a Process Bean. 
* In this simple example, there is only one Process Bean in the process-conf.xml file.
* In normal practice, though, you would have a number of Process Bean sections in the configuration file, so calling out the specific process would make sense.
* The process-conf.xml file consists of a set of property-value pairs.
* The file used for this sample process is shown below, with an explanation of the key entries following the listing.
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="csvInsertArtist"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
        <description>Inserts artist names from CSV file into Artist custom object.</description>
        <property name="name" value="csvInsertArtist"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.debugMessages" value="false"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\csvInsertArtist.log"/>
                <entry key="sfdc.endpoint" value="https://www.salesforce.com"/>
                <entry key="sfdc.username" value="<i>Your Salesforce ID</i>"/>
                <entry key="sfdc.password" value="<i>Your encrypted Salesforce password</>"/>
                <entry key="sfdc.timeoutSecs" value="540"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="Artist__c"/>
                <entry key="process.operation" value="insert"/>
                <entry key="process.mappingFile" value="c:\dataloader\artistmap.sdl"/>
                <entry key="process.outputError" value="c:\dataloader\errorInsertArtist.csv"/>
                <entry key="process.outputSuccess" value="c:\dataloader\successInsertArtist.csv"/>
                <entry key="dataAccess.name" value="c:\dataloader\Artists_1_100.csv" /> 
                <entry key="dataAccess.type" value="csvRead" /> 
                <entry key="process.initialLastRunDate" value="2007-06-06T00:00:00.000-0800"/>
            </map>
        </property>
   </bean>
</beans>
 Configuration properties:
The process-conf.xml file contains properties for one or more Process Beans. Some of the more important properties are
  • name - used to identify the bean in the config.properties file and when you call it from the CLI
  • sfdc.entity - the Salesforce object that is the target of the actions. The value of this property is case sensitive.
  • process.operation - identifies the type of operation
  • process.mappingFile - identifies the mapping between the fields in the source file (dataAccess.name) and the Salesforce object. This mapping file is a .sdl file. The mapping file is the same format as the .sdl file created by the GUI when you save a mapping scheme.
  • dataAccess.type - identifies the operation to perform on the source file
  • sfdc.username - your Salesforce.com user name 
* To schedule the file we should open windows Task Scheduler.
C:\Program Files (x86)
C:\Program Files (x86)\salesforce.com\Data Loader\bin
process ../conf csvInsertArtist

* C:\Program Files (x86)
C:\Program Files (x86)\salesforce.com\Data Loader\bin
process ../conf csvInsertArtist
-- Save it as filename.bat--
Refer:
Data Loader CLI

Wednesday, 12 September 2012

Latest Versions in SFDC



Name
Latest Version
Apex Data loader
29.0
Force.com API
29.0
Force.com IDE
29.0.0 (compatible with Eclipse 4.2 and 4.3)
Salesforce.com
Winter' 2014


Tuesday, 11 September 2012

Upsert

* upsert sObject​​ opt_external_id
* opt_external_id​​ is an optional variable that specifies the custom field that should be used to match records that already exist in your organization's data
How Upsert Chooses to Insert or Update
Upsert uses the sObject record's primary key (or the external ID, if specified) to determine whether it should create a new object record or update an existing one:
  • If the key is not matched, then a new object record is created.
  • If the key is matched once, then the existing object record is updated.
  • If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.


Refer:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_upsert.htm

Tuesday, 31 July 2012

Apex Data Loader

* Data Loader is a client application for the bulk import or export of data. (Up to 5 million records)
* Use it to insert, update, delete, or export Salesforce records.
* When importing data, Data Loader reads, extracts, and loads data from comma separated values (CSV) files or from a database connection.
* When exporting data, it outputs CSV files.
Note: If commas are not appropriate for our locale, use a tab or other delimiter.

We can use Data Loader in two different ways:

User interface—When we use the user interface, we work interactively to specify the 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—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
• 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 7

Use Data Loader when:
* You need to load 50,000 to 5 million records.
* Data Loader is supported for loads of up to 5 million records.
* If you need to load more than 5 million records, we recommend you work with a salesforce.com 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.

Use the import wizards when:
• You are loading less than 50,000 records.
• The object you need to import is supported by import wizards.
* To see import wizards click Your Name > Setup > Data Management.
• You want to prevent duplicates by uploading records according to account name and site, contact email address, or lead email address.

Login Considerations
* If your organization restricts IP addresses, logins from untrusted IPs are blocked until they’re 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.

Configuring Data Loader
Use the Settings menu to change the default operation settings of Data Loader.
1. Start Data Loader by choosing Start > Programs > salesforce.com > Data Loader > Data Loader.
2. Choose Settings > Settings.
3. Edit the fields as desired:

Field
Description
Batch size
* In a single insert, update, upsert, or delete operation, records moving to or from Salesforce are processed in increments of this size.
*The maximum value is 200. We recommend a value between 50 and 100.
*The maximum value is 10,000 if the Use Bulk API option is selected.
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.
Timeout
Specify how many seconds Data Loader waits to receive a response back from the server before returning an error for the request.
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.
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).
*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.

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.
*It’s faster than the default SOAP-based  API due to parallel processing and fewer network round-trips.
Caution:
*When you select the Hard Delete operation, the deleted records are not stored in the Recycle Bin.
*Instead, they become immediately eligible for deletion.
*The permission for this operation, “Bulk API Hard Delete,” is disabled by
default and must be enabled by an administrator.
*A Salesforce user license is required for hard delete.
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.
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.
 To configure Data Loader to use the Bulk API for inserting, updating, upserting, deleting, and hard deleting records:
1. Start Data Loader by choosing Start > Programs > salesforce.com > Data Loader > Data Loader.
2. Choose Settings > Settings.
3. Select the Use Bulk API option.
4. Click OK.
Refer:
http://blogs.salesforce.com/blogs/2005/08/importing_attac.html

Labels