+ Start a Discussion
Pedro Garcia GPedro Garcia G 


I've tried from many ways and read a lot of forum topics, articles, etc but I'm not able to connect through the Data Loader using the CLI option.
I want to import Lead using the Data Loader in Batch files.
Note: I've already connected and imported Lead using the Data Loader GUI. I use the Password Authentication option and the password is: Mypassword + token
What I did:
Create the Encrypted password from the command line: https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta/dataLoader/loader_encryption.htm
Create a folder at C:\SALESFORCE\ and copied there all files I needed:
In-Progress_report.csv It's the csv files with the leads. it was previously imported with the Data Loader GUI

I run the following script:
..\bin\process.bat c:\SALESFORCE leadInsert

I got the following error:
Caused by: [LoginFault [ApiFault  exceptionCode='LOGIN_MUST_USE_SECURITY_TOKEN' exceptionMessage='Invalid username, password, security token; or user locked out. Are you at a new location? When accessing Salesforce--either via a desktop client or the API--from outside of your companyÆs trusted networks, you must add a security token to your password to log in. To get your new security token, login to Salesforce. From your personal settings, enter Reset My Security Token inthe Quick Find box, then select Reset My Security Token.'

I've already reset my Token.

I appreciate any helps, thanks!

Progress-conf.xml file
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
	<bean id="leadInsert" class="com.salesforce.dataloader.process.ProcessRunner" singleton="false">
		<description>accountInsert job gets	the account	record from the CSV file and inserts it into Salesforce.</description>
		<property name="name" value="leadInsert" />
		<property name="configOverrideMap">
				<entry key="sfdc.debugMessages" value="false" />
				<entry key="sfdc.debugMessagesFile" value="c:\SALESFORCE\sfdcSoapTrace.log" />
				<entry key="sfdc.endpoint" value="https://test.salesforce.com" />
				<entry key="sfdc.username" value="my_username_in_sandbox" />
				<!--Password below is the result of the encrypted using key file,
encrypt.bat -e Mypassword
Note: For this post, it's not the real password
				<entry key="sfdc.password" value="0231db029bxb88x82d3daex3bxf1829e5b99122x82e0f49beb0xdf193890433f"
				<entry key="process.encryptionKeyFile" value="c:\SALESFORCE\thekey.txt" />
				<entry key="sfdc.timeoutSecs" value="600" />
				<entry key="sfdc.loadBatchSize" value="200" />
				<entry key="sfdc.entity" value="Lead" />
				<entry key="process.operation" value="insert" />
				<entry key="process.mappingFile"  value="c:\SALESFORCE\LEAD_NDCAS_INPROGRESS.sdl" />
				<entry key="dataAccess.name" value="c:\SALESFORCE\In-Progress_report.csv" />
				<entry key="process.outputSuccess" value="c:\SALESFORCE\lead_success.csv" />
				<entry key="process.outputError" value="c:\SALESFORCE\leadInsert_error.csv" />
				<entry key="dataAccess.type" value="csvRead" />
				<entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800" />
				<entry key="process.outputError" value="C:\SALESFORCE\ProcessOutputError.csv"/>

SandhyaSandhya (Salesforce Developers) 

Did you create encrypted password from the command line.

Best Regards,
Pedro Garcia GPedro Garcia G
Hi Sadhya, thank you for your reply

Yes, I did it. I followed the instruction in: https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta/dataLoader/loader_encryption.htm

1. I generated the key file:
encrypt -k c:\SALESFORCE\thekey.txt

2. I encrypted the password:
encrypt -e mypassword c:\SALESFORCE\thekey.txt
it returns the encrypted password, this is the encrypted password I put in the Progress-conf.xml file

3. I double check the encrypted password:
encrypt -d 0231db029bxb88x82d3daex3bxf1829e5b99122x82e0f49beb0xdf193890433f c:\SALESFORCE\thekey.txt
it returns: mypassword

As I've tried many times and many ways. I added the token nomber in the step 2. The only thing I see different in the post you've mentioned is:
in the commnad line they enclose the passowrd between "mypassword"... I'll try this way.

Chris Eastwood 7Chris Eastwood 7
Hey Pedro. We are running into the same issue. Did you find a solution to this error?
Pedro Garcia GPedro Garcia G
Hi Chris, Yes... the SF technical support recommend to manage the IP range instead of passing the password + token. So, it works for me now. Let me know if this works for you.
Chris Eastwood 7Chris Eastwood 7
Thanks Pedro, that fixed it for us.
Amy ShatzenAmy Shatzen
I had this same issue and was able to resolve it without using IP range.
The password and security token have to be encrypted together.
So, the encryption command looks like this:

encrypt -e [password][SecurityToken] c:\SALESFORCE\thekey.txt
For example:
encrypt -e mypasswordqk51o6MA7MuVDO2ac3qZ4Evk8 c:\SALESFORCE\thekey.txt

This creates an extremely long encrypted password string to put in the process-conf.xml file, but it worked.
Luca Izzo 7Luca Izzo 7
Thanks Amy, your solution work for me !