Schedule data loader in Salesforce

Data loader is a tool provided by the salesforce so that we can perform various functions through it. The functions could be insert, update, delete, export, export all, upsert. This is a migration tool which is used to migrate data more than 50,000 in number, but a drawback of it is that it cannot scheduled.

Thus to overcome this drawback we make use of dataloader through command line interface which is scheduled with task manager.

The most important part of setting up Salesforce Command Line Data loader is to generate the encrypted password using utility provided by the Data Loader.

C:\Program Files (x86)\salesforce.com\Data Loader\bin

How to schedule data loader in Salesforce

Before we start with the steps we in data loader cli need to create a folder (with any name, I used dataloader) which should have files with names.

1) Key.txt

2) Encrypted.txt

3) Success.csv

4) Errors.csv

5) AccountInsertMap.sdl or with csv extension.

Steps to schedule data loader in Salesforce

Step1:

Create Encryption Key

1. Open a command prompt.

2. In the cmd enter cd\ to navigate to the root directory of the drive where the dataloader is installed.

3. Enter to the bin through this command.

Cd C:\Program Files(x86)\salesforce.com\Apex Data Loader 22.0\bin

4. Generate an encryption Key

Encrypt.bat “g <seedtext>

Replace seedtext with any string.

schedule data loader salesforce

Step 2

Create the encrypted password.

In the same command prompt you have the following command:

Encrypt.bat <password> <filepath>\ key.txt

Replace with the password with which the dataloader login to salesforce and replace the filepath with the key.txt path.

Salesforce data loader schedule

Copy the encrypted password that is generated by the command prompt. We will discuss this later.

Step 3

Create a mapping file with name accountInsertMap.sdl or a csv file. The data is insert so that the left hand side data is equal to the destination field on right hand side.

#Mapping values

#Thu May 26 16:19:33 GMT 2011

Name=Name

NumberOfEmployees=NumberOfEmployees

Industry=Industry

OR

The accountInsertMap.csv

Data loader scheduler salesforce

Step 4

Create configuration file

Contains all the information the data loader needs to perform. Each bean of the config file perform individual function such as insert, delete, update etc. We perform export from the following file.

Parameters for Process-config.xml:

Sfdc .endpoint:-Enter the URL of the Salesforce instance for your organization, for example

https://test.salesforce.com

sfdc.username:-Enter the username with which your login to dataloader.

Sfdc.password: -Enter the password encrypted password which you create in step 2.

dataAccess.Name: -Enter the path and file name of the data file that contains the Accounts that you want to import.

The process-con file should be present in the dataloader folder.

how to schedule data loader in salesforce

Step 5

1) Copy the following data to the filename accountInsert.csv. This is the account data which can be imported into the organization. You can have your own values.

Name, Number of Employees, Industry

Dickenson plc, 120, Consulting

Gene Point, 265, Biotechnology

Express Logistics and Transport, 12300, Transportation

Grand Hotels & Resorts Ltd, 5600, Hospitality

2)In the command prompt window, we have the following command.

Process.bat <path to process-con.xml> process name

schedule data loader scheduler

Note: –

Provide the path to process-con.xml and in the process provide the name of the process name.

In our case the process name will be insertAccounts as is present in the process-con.xml file.

<property name=”name” value=”insertAccounts”/>

After the process runs the command prompt enter the success and error messages.

You can also check with the log files with the names success.csv and error.csv

The execution of the command also creates a log file, as the path needs to be given where the log file need to be created.

<entry key=”sfdc.debugMessagesFile” value=”C:\Users\Desktop\data loader\log\accountInsertSoaptrace.log”/>

Now another step is quite essential to schedule the command line dataloader, for this we require a bat file named as process.bat. This bat file contains path till bin and the path for the process-con.xml

This bat file should be present in the dataloader folder.

salesforce data loader schedule

Steps of Scheduling dataloader through windows: –

Click on start->control panel->System and security->Administrative tools->Task scheduler.

data loader scheduler salesforce

1) Click on create task in actions.

2) Provide the name of the schedule task.

3) Set up trigger timings as required to schedule the data loader jobs.

4) Set up an action with action type as Start Program and add process.bat file.

5) Save the task.

The scheduler will run the data loader processes as per the trigger time set in windows scheduler task. This is how we schedule data loader through command line interface.

Rashi Krishna

Salesforce developer at Mirketa Inc.
Posted in Apex Data Loader, Apex Development, Data Loader, DataLoader, Salesforce, Salesforce.com, sfdc. Tagged with .

Leave a Reply

Your email address will not be published. Required fields are marked *

*