1.
Download Apex data loader. Navigate to Set
up->Administration Set up->Data management->Data Loader. Click on
Download Data Loader link.
2.
Install apex data loader setup. C:\Program Files (x86)\salesforce.com\Apex
Data Loader 23.0 will be default location while installing.
Below are the steps in order to achieve our requirement:
1. Create a folder and name it as “data Loader Demo” in E drive.
2. Generate Key File.
Open Command Prompt (Go to run-type cmd press enter), change directory to bin:
cd Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin> press enter
Now type :
Encrypt –g randomtext
cd Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin> press enter
Now type :
Encrypt –g randomtext
key will be generated, copy the key in notepad and save it as keyToEncrypt.txt in data Loader Demo folder. Note the path of this Key.txt file. In our case path is E:\Data Loader Demo\keyToEncrypt.txt
3. Encrypt Password and security token.
In command prompt, type
Encrypt –e password+securitytoken “ path of key.txt file”
For example:
Encrypt –e xxxxxx129k19YRftloxFbgBMkb6NZsNK “E:\Data Loader Demo\keyToEncrypt.txt"
Encrypt –e password+securitytoken “ path of key.txt file”
For example:
Encrypt –e xxxxxx129k19YRftloxFbgBMkb6NZsNK “E:\Data Loader Demo\keyToEncrypt.txt"
Save the encrypted password for later use.
In our case generated password is:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6c75bb5c73f60175181c7aa5d1441aee65c
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6c75bb5c73f60175181c7aa5d1441aee65c
4. Create 4 new folders as Mapping files, Log files, extracted Accounts and Account data folder in Data Loader demo folder
Create mapping files for insert and delete from Apex Data Loader GUI and copy paste in Mapping files folder
Create insertAccounts.csv file in Account data folder which will be inserted into salesforce.
Log files folder will be used to store success and error files.
5. Copy config.properties from below mentioned directory:
C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\conf
Paste this file in “Data Loader Demo” folder.
Also copy process-conf.xml file from below mention directory to “Data Loader Demo folder”
C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\samples\conf
Data Loader Demo folder:
6. Now edit process-conf.xml file in notepad:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> | |
<beans> | |
<!-- inserting accounts command: process "E:\Data Loader Demo" accountInsert --> | |
<bean id="accountInsert" | |
class="com.salesforce.dataloader.process.ProcessRunner" | |
singleton="false"> | |
<description>inserting Account from csv files</description> | |
<property name="name" value="accountInsert"/> | |
<property name="configOverrideMap"> | |
<map> | |
<entry key="sfdc.endpoint" value="https://login.salesforce.com"/> | |
<entry key="sfdc.username" value="sunil02kumar@gmail.com"/> | |
<!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile | |
the password is not a valid encrypted value, please generate the real value using encrypt.bat utility --> | |
<entry key="sfdc.password" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6c75bb5c73f60175181c7aa5d1441aee65c"/> | |
<entry key="process.encryptionKeyFile" value="E:\Data Loader Demo\keyToEncrypt.txt"/> | |
<entry key="sfdc.timeoutSecs" value="600"/> | |
<entry key="sfdc.loadBatchSize" value="200"/> | |
<entry key="sfdc.entity" value="Account"/> | |
<entry key="process.operation" value="insert"/> | |
<entry key="process.mappingFile" value="E:\Data Loader Demo\Mapping files\accountInsertMap.sdl"/> | |
<entry key="dataAccess.name" value="E:\Data Loader Demo\Account data\insertAccounts.csv"/> | |
<entry key="process.outputSuccess" value="E:\Data Loader Demo\Log files\accountInsert_success.csv"/> | |
<entry key="process.outputError" value="E:\Data Loader Demo\Log files\accountInsert_error.csv"/> | |
<entry key="dataAccess.type" value="csvRead"/> | |
<entry key="process.initialLastRunDate" value="2006-12-01T00:00:00.000-0800"/> | |
</map> | |
</property> | |
</bean> | |
<!--if we specify mapping file while exporting then it will extract only those fields mention in mapping file --> | |
<!--if we do not specify mapping file then it will extract all fields specified in query --> | |
<!-- command: process "E:\Data Loader Demo" csvAccountExtractProcess --> | |
<bean id="csvAccountExtractProcess" | |
class="com.salesforce.dataloader.process.ProcessRunner" | |
singleton="false"> | |
<description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description> | |
<property name="name" value="csvAccountExtractProcess"/> | |
<property name="configOverrideMap"> | |
<map> | |
<entry key="sfdc.debugMessages" value="false"/> | |
<entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\sfdcSoapTrace.log"/> | |
<entry key="sfdc.endpoint" value="https://login.salesforce.com"/> | |
<entry key="sfdc.username" value="sunil02kumar@gmail.com"/> | |
<!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile | |
the password is not a valid encrypted value, please generate the real value using encrypt.bat utility --> | |
<entry key="sfdc.password" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6c75bb5c73f60175181c7aa5d1441aee65c"/> | |
<entry key="process.encryptionKeyFile" value="E:\Data Loader Demo\keyToEncrypt.txt"/> | |
<entry key="sfdc.timeoutSecs" value="600"/> | |
<entry key="sfdc.loadBatchSize" value="200"/> | |
<entry key="sfdc.entity" value="Account"/> | |
<entry key="sfdc.extractionRequestSize" value="500"/> | |
<entry key="sfdc.extractionSOQL" value="Select Id, Name, ParentId, Phone,Industry FROM Account where Phone='9790750361' AND Industry='Textile'"/> | |
<entry key="process.operation" value="extract"/> | |
<!-- <entry key="process.mappingFile" value="c:\dataloader\samples\conf\accountExtractMap.sdl"/> --> | |
<entry key="dataAccess.type" value="csvWrite"/> | |
<entry key="dataAccess.name" value="E:\Data Loader Demo\extracted Accounts\extractAccounts.csv"/> | |
<!--<entry key="process.outputSuccess" value="E:\Data Loader Demo\Log files\accountexport_success.csv"/> | |
<entry key="process.outputError" value="E:\Data Loader Demo\Log files\accountexport_error.csv"/> --> | |
</map> | |
</property> | |
</bean> | |
<!--deleting extracted records command: process "E:\Data Loader Demo" AccountDeleteProcess --> | |
<bean id="AccountDeleteProcess" | |
class="com.salesforce.dataloader.process.ProcessRunner" | |
singleton="false"> | |
<description>Delete account with exported file"</description> | |
<property name="name" value="AccountDeleteProcess"/> | |
<property name="configOverrideMap"> | |
<map> | |
<entry key="sfdc.debugMessages" value="false"/> | |
<entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\sfdcSoapTrace.log"/> | |
<entry key="sfdc.endpoint" value="https://login.salesforce.com"/> | |
<entry key="sfdc.username" value="sunil02kumar@gmail.com"/> | |
<!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile | |
the password is not a valid encrypted value, please generate the real value using encrypt.bat utility --> | |
<entry key="sfdc.password" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6c75bb5c73f60175181c7aa5d1441aee65c"/> | |
<entry key="process.encryptionKeyFile" value="E:\Data Loader Demo\keyToEncrypt.txt"/> | |
<entry key="sfdc.timeoutSecs" value="600"/> | |
<entry key="sfdc.loadBatchSize" value="200"/> | |
<entry key="sfdc.entity" value="Account"/> | |
<entry key="process.operation" value="delete"/> | |
<entry key="process.mappingFile" value="E:\Data Loader Demo\Mapping files\accountDeleteMap.sdl"/> | |
<entry key="dataAccess.type" value="csvRead"/> | |
<entry key="dataAccess.name" value="E:\Data Loader Demo\extracted Accounts\extractAccounts.csv"/> | |
<entry key="process.outputSuccess" value="E:\Data Loader Demo\Log files\accountdelete_success.csv"/> | |
<entry key="process.outputError" value="E:\Data Loader Demo\Log files\accountdelete_error.csv"/> | |
</map> | |
</property> | |
</bean> | |
</beans> |
7. Create Batch file to do the operation in bin folder.
Create a new text file with following content:
call process "E:\Data Loader Demo" accountInsert
call process "E:\Data Loader Demo" csvAccountExtractProcess
call process "E:\Data Loader Demo" AccountDeleteProcess
call process "E:\Data Loader Demo" csvAccountExtractProcess
call process "E:\Data Loader Demo" AccountDeleteProcess
Save the file as autorundataloadcommandlineinterface.bat and store it in bin folder
Path : C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin
8. Run the batch.
Open cmd, change the directory to bin “C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin” and type autorundataloadcommandlineinterface.bat, and press enter
OR you can double click on bat file to execute the process.
Now check your log files and extracted Accounts folder to see success and error files and extracted account file.Steps to schedule the data upload process or to start execution of bat file
1. Control Panel->System and Security->Administrative Tools->task scheduler->create basic task->
Browse > C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin \autorundataloadcommandlineinterface.bat file and click next
Good one. Its simple and clear
ReplyDeleteIs there any way to store the extracted file with today's date or time value along with file name ??
ReplyDeleteThe article provided by you is very nice and it is very helpful to know the more information about salesforce .keep update with your blogs.....
ReplyDeleteonline form builder for salesforce
I am getting access denied to mapping file.
ReplyDeleteHi ,
ReplyDeleteI need to send email if any error will come
Masha Allah post padh kar kaafi jankari hasil huyi.
ReplyDeleteDiscover the exquisite world of Ammara Khan's bridal couture dresses. From ravishing Pakistani bridal dresses to elegant bridal dresses for barat and mesmerizing bridal shower dresses, Ammara Khan has it all. Explore our collection and make your special day truly unforgettable.
ReplyDelete