Saturday, 7 November 2020

CLI Data Loader - Salesforce

Prerequisite: Install Java and Dataloader.

Step 1: Prepare your key for encrypting the password of your org:

·                        Open the command prompt window, and navigate to the bin folder of data loader directory

·                        Use the command encrypt.bat -k .



·                        Once you will hit enter, it will generate the keyfile and shows the location. Copy the link for further use and paste it somewhere.

 


         encrypt.bat -e July2020@9vZcKyrv8IyCDiRfP39xCLgT "C:\Users\iAnil\.dataloader\dataLoader.key"

         Add password+token of the sandbox/org and add the link of KeyFile.


          Hit enter then it will generate encrypted password for your org. Copy it paste it somewhere. It will be used in CLI Script.

          Create DataLoaderFiles folder or create a folder with your name choice outside Program Files folder. In my case I have created in C drive. Path is C:\DataLoaderFiles.

      Step 2: Prepare your mapping file:

      Create the mapping file by putting the CSV file header name on left side and Salesforce API name on right side. Move the mapping file to  C:\DataLoaderFiles location. I have used the below sdl file for extracting account.



    Step 3: Prepare your process-conf:

·                    Create the process-conf file to  C:\DataLoaderFiles location. (xml file)

·                    Edit the file and enter your information.

sfdc.endpoint – Production URL/Sandbox URL.

sfdc.username – Your username from the org.

sfdc.password – Encrypted password, created in earlier steps.

process.mappingFile – Specify path of mapping file.

dataAccess.name - Specify path of csv file.

process.outputSuccess – Specify path where you want success file

process.outputError – Specify path where you want error file



Step 4: Prepare your bat file:

·                 Create txt file and save it with .bat extension in Dataloader bin folder



Specify path of the process-conf file and name of process-conf in batchable file.

 

Step 5: Schedule batch file with windows scheduler:

·                 Schedule the batch file with task scheduler as per your required time to insert the data.

Note : Once this process completed, data will be inserted into Account object.