About Me

My photo
PLANO, Texas, United States

Saturday, March 12, 2016

Schedule the APEX Data Loader

In order to execute the data loader activity on the particular time, First we have to create .bat file and then we have to schedule it. This article describes how to create the .bat file and how can we schedule it.
  • Create the .bat file
Once you setup all file (process-conf, sample.key) for the data loader CLI, we need to create the .bat file  so that we can schedule this file. 

Write the below script in notepad and save it as fileName.bat.

REN Call the Process from Below Command 
cd "C:\Program Files (x86)\salesforce.com\Data Loader\bin"
CALL process "C:\Users\user\Desktop\Data Loader CLI\samples\conf"  "csvTaskExtractProcess"
REN Rename the file name appending Date and time
for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%i%%j
echo Date: %yyyymmdd%
for /F "tokens=1-2 delims=: " %%l in ('time /t') do set hhmm=%%l%%m
echo Time: %hhmm%
echo %yyyymmdd%%hhmm%
rename "C:\Users\user\Desktop\Data Loader CLI\samples\data\Virtual_Engagement_Contact_Details _IB_.csv" "Virtual_Engagement_Contact_Details _IB_%yyyymmdd%%hhmm%.csv"

pause
  • Schedule a Batch File to run automatically
Step 1: Create a batch file you wish to run and place it under a folder where you have enough permissions. For example under C drive.

Step 2: Click on Start and under search(Setting), type in Task Scheduler.












Step3: Click on Create Task and fill the required details and schedule the bat file.